如何仅在未处理的异常上使 Visual Studio 中断?

如何仅在未处理的异常上使 Visual Studio 中断?

问题描述:

在我的其他机器上,当没有 try/catch 来处理它们时,Visual Studio 总是因错误而中断,但如果有 try/catch 则它没有中断.

On my other machines, Visual Studio always broke on errors when there was not a try/catch to handle them, but if there was a try/catch then it didn't break.

出于某种原因,在这台笔记本电脑上,它不能那样工作.一开始它根本没有中断,但后来我发现了如何通过调试/异常将其设置为中断.但是,将其配置为在那里中断会导致它始终在异常时中断,即使存在 try/catch 块也是如此.

For some reason, on this laptop, it doesn't work that way. It didn't break at all at first, but then I found out how to set it to break by going to debug/exceptions. However, configuring it to break there causes it to always break on exceptions even if there is a try/catch block.

我如何让它像以前一样工作?

How do I make it work like I'm used to?

通过进入工具-->选项-->调试器-->常规--确保您已仅启用我的代码> 启用仅我的代码.这将更改您的调试--> 异常对话框以显示用户未处理错误的复选框.

Make sure you have Just My Code Enabled by going into Tools-->Options-->Debugger-->General--> Enable Just My Code. This will change your Debug--> Exceptions Dialog Box to show a CheckBox for User-unhandled Errors.