如何在VS2010中允许打破'System.NullReferenceException'?

Mik*_*ebb 16 c# debugging break visual-studio-2010 nullreferenceexception

我有一个VS 2010 C#.NET 4项目.问题是程序在调试期间没有破坏'NullReferenceException'错误.

输出窗口将显示以下内容:

A first chance exception of type 'System.NullReferenceException' occurred in myProgram.exe

...但是调试器将退出该函数并继续运行该程序的其余部分.

如何更改此行为以便调试器在这些异常中中断?

Fem*_*ref 43

转到Debug - > Exceptions - > Search for NullReferenceException并选中"thrown"复选框.

  • 它现在隐藏在调试 > Windows > 异常设置中。 (5认同)
  • 哇.. 3年我一直在想如何做到这一点.我应该在VS中使用更多按钮而不是构建和运行. (3认同)
  • 谢谢。永远不会发现。 (2认同)