当第一次机会异常发生时,如何启用Visual Studio 2010中断? [英] How do I enable Visual Studio 2010 to break when a first chance exception happens?

查看:203
本文介绍了当第一次机会异常发生时,如何启用Visual Studio 2010中断?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在阅读Stack Overflow问题



如果您检查给定的异常,调试器执行将破坏抛出异常的任何地方的
,无论是处理还是
未处理。此时异常称为第一次机会
异常。


请参阅 如何:当异常被抛出时中断 有关更多信息。


I was reading Stack Overflow question How can I set Visual Studio to show a stack trace for first chance exceptions? regarding debugging first chance exceptions on Visual Studio 2010, and I am not able to find this option.

How can I enable Visual Studio 2010 to break exactly when a first chance exception happens?

解决方案

You may want to check the Debug menu in Visual Studio 2010. In there you will find the Exception submenu, in where you can select which type of exception you want Visual Studio to stop.

Setting the debugger to break when an exception is thrown

The debugger can break execution at the point where an exception is thrown, giving you a chance to examine the exception before a handler is invoked.

In the Exception Settings window, expand the node for a category of exceptions (for example, Common Language Runtime Exceptions, meaning .NET exceptions), and select the check box for a specific exception within that category (for example System.AccessViolationException). You can also select an entire category of exceptions.

If you check a given exception, debugger execution will break wherever the exception is thrown, regardless of whether it is handled or unhandled. At this point the exception is called a first chance exception.

See How to: Break When an Exception is Thrown for more info.

这篇关于当第一次机会异常发生时,如何启用Visual Studio 2010中断?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆