#914 – Using the Debugger to Break when an Exception Is Thrown
August 22, 2013 1 Comment
By default, if you have an exception handler defined, the debugger in Visual Studio will not break (i.e. stop) at the point where an exception is thrown.
You can, however, configure Visual Studio to break at the point when the exception is thrown. To enable breaking when an exception is thrown, do the following:
- From the Debug menu, select Exceptions…
- Find the specific type of exception for which you want the debugger to break and click on the Thrown column. You can select an entire class of exceptions, or a specific exception type. In the example below, we select all Common Language Runtime Exceptions.
- Click the OK button
Now, when you run in debug mode, the debugger will display a dialog at the point where an exception is thrown and give you a chance to break (stop).
If you do break, you can then examine the exception object.