简体   繁体   English

Visual Studio 2013“打破处理的异常”不起作用,而不是破坏

[英]Visual Studio 2013 “break on handled exceptions” not working, not breaking

I am debugging an asp.net application on iisexpress.exe, I have configured visual studio 2013 to break on user-handled exceptions through the exception settings window but it still does not break when an exception is thrown. 我在iisexpress.exe上调试一个asp.net应用程序,我已经配置了visual studio 2013来通过异常设置窗口中断用户处理的异常,但是当抛出异常时它仍然没有中断。 When I pause execution I can see on the Intellitrace window that a lot of exceptions were thrown but visual studio didn't break. 当我暂停执行时,我可以在Intellitrace窗口看到很多异常被抛出但是visual studio没有破坏。

Ok, it seems it was because of the "Enable Just My Code" options was selected under 好吧,似乎是因为选择了“启用我的代码”选项

Options->Debugging->General 选项 - > Debugging->常规

I don't know why but by default, it is checked. 我不知道为什么,但默认情况下,它被检查。 Any ideas? 有任何想法吗? Should I leave it checked/unchecked? 我应该选中/取消选中吗?

@Navad, how the debugger works is that when you have "Just My Code" enabled, the debugger will only break on First Chance Exceptions (thrown, but handled) in user code. @ Navav,调试器的工作原理是,当你启用“Just My Code”时,调试器只会破坏用户代码中的First Chance Exceptions(抛出但处理)。 Where the debugger defines user code to be code that is compiled "Debug" and you have symbol files (.pdb's) for, or if the assembly is built by a project that is part of your solution. 调试器将用户代码定义为编译为“Debug”的代码,并且您具有符号文件(.pdb),或者如果程序集是由作为解决方案一部分的项目构建的。 In general Just My Code is what you likely want, as if you disable it and turn on first chance exceptions you will break on any exceptions that occur even in framework code you don't control. 一般来说,Just My Code就是您可能想要的,就像您禁用它并打开第一次机会异常一样,即使在您无法控制的框架代码中,也会出现任何异常。 Additionally when it is enabled, if you don't catch the Exception in user code the debugger will break and treat it as if it was unhandled. 另外,当它启用时,如果你没有在用户代码中捕获异常,调试器将会中断并将其视为未处理。 However if you disable Just My Code, you will break on the exception only if it is truly unhandled. 但是,如果禁用“仅我的代码”,则只有在真正未处理的情况下才会中断异常。 For example some frameworks will catch exceptions so the debugger will only break if you switch it to thrown, because no exceptions in your code actually go unhandled, they are only "User Unhandled". 例如,一些框架将捕获异常,因此调试器只有在您将其切换为抛出时才会中断,因为代码中没有异常实际上未处理,它们只是“用户未处理”。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM