如何允许中断“System.NullReferenceException”?在VS2010中?

发布于 2024-10-08 01:29:51 字数 248 浏览 0 评论 0原文

我有一个 VS 2010 C# .NET 4 项目。问题是程序在调试期间不会因“NullReferenceException”错误而中断。

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

MyProgram.exe 中发生了类型为“System.NullReferenceException”的第一次机会异常

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

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

I have a VS 2010 C# .NET 4 project. The issue is that the program is not breaking on 'NullReferenceException' errors during debugging.

The output window will display the following:

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

...but the debugger will just exit out of the function and continue running the rest of the program.

How do I change this behavior so that the debugger will break on these exceptions?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

落墨 2024-10-15 01:29:51

转到调试->例外情况->搜索 NullReferenceException 并选中“抛出”复选框。

Go to Debug -> Exceptions -> Search for NullReferenceException and check the "thrown" checkbox.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文