How do I enable Visual Studio 2010 to break 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.

enter image description here

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.

Leave a Comment