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

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

问题描述

我正在阅读堆栈溢出问题

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

请参阅如何:在抛出异常时中断 了解更多信息.

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天全站免登陆