视觉工作室中的异常断点 [英] Breakpoint on an exception in visual studio
问题描述
如何设置异常断点?
理想情况下,我希望能够从抛出异常的代码中看到调用栈和局部变量。
How do I set a breakpoint on an exception? Ideally I want to be able to see the call stack and local variables from the code that threw the exception.
推荐答案
我没有使用Visual Studio 2年,但从记忆中:
I haven't used Visual Studio for 2 years, but from memory:
Ctrl + Alt + E
将提供异常管理屏幕,确保检查所有异常中断,必须有imho:)
Will bring exception management screen, make sure to check break on all exceptions, a must have imho :)
编辑:我的记忆不错 :)只需检查抛出
在公共语言运行时异常
如果你使用.NET(CLR = .NET)
EDIT : My memory not that bad :) Just check Thrown
on Common Language Runtime Exceptions
if your are using .NET (CLR = .NET)
编辑2 :顺便说一句, 通常不好的编码习惯,尽可能避免,我建议让该选项始终启用 。如果一些例外是不能避免的(因为别人,当然:D)只是在异常类型树中取消它的类型或祖先。
EDIT 2 : By the way, since exceptions are generally a bad coding practice and should be avoided as possible, i suggest to let that option enabled all the time. If some exceptions just can't be avoided (because of someone else, of course :D) just uncheck its type or ancestor in the exception type tree.
这篇关于视觉工作室中的异常断点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!