如何暂时停用所有try/catch块? [英] How to temporarily deactivate all try / catch blocks?
问题描述
是否有可能像单击按钮一样轻松地激活/激活整个项目中的所有try catch块?
Is there a possibility to deactivate / activate all try catch blocks in the whole project as easy as clicking a button?
当我不希望catch块处理异常时,我需要使用它进行调试,而是希望VS像尝试catch块一样不插入代码中.
I need this for debugging when I don't want the catch block to handle the exception, but instead prefer that VS breaks into the code as if the try catch block was not there.
此刻,我正在注释掉try/catch块,但这效率低下.
At the moment I am commenting out the try/catch blocks but this is inefficient.
环境:以C#为语言的VS 2008.
Environment: VS 2008 with C# as language.
推荐答案
要在引发异常时立即捕获异常(在Win32中是"first-chance异常"):
To catch exceptions the moment they're thrown ("first-chance exceptions" in Win32 parlance):
-
VS2008中的
-
:转到调试,例外...
in VS2008: go to Debug, Exceptions...
:已移至 Debug> Windows> Exception Settings
然后选中引发复选框以获取公共语言运行时异常.
Then check the box Thrown for Common Language Runtime Exceptions.
这篇关于如何暂时停用所有try/catch块?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!