Friday, June 19, 2009

DevTnT 7 – How to Stop on First Chance Exceptions in Visual Studio

In many applications you do some exception handling which implies catching exceptions and displaying the error to the user in a proper way or just log it into a file oder database. During the debugging process you might want to jump to the code where the exception was originally thrown (“first chance exception”).

Using Visual Studio .NET, you can configure how the debugger handles first chance exceptions on a per exception basis or for exception families (by namespace and/or runtime). Select Debug – Exceptions (or use CTRL+ALT+E) and now you can enable “Thrown”-checkboxes for exception types you want the debugger to stop immediately.


Note: The same effect for a single exception can be reached by using the System.Diagnostics.Debugger.Break() method.

No comments:

Post a Comment