Configuring How the Visual Studio Debugger Handles Custom Exceptions

A few days ago, I posted on how to configure the debugger to stop on first chance exceptions in Visual Studio .NET 2003 and Visual Studio 2005.  Today, I'd like to talk about how to configure the Visual Studio debugger for handling custom exceptions implemented in your code.

Visual Studio .NET 2003
When running Visual Studio .NET 2003, use the steps below to add support for your custom managed exceptions.

  • Start Visual Studio .NET 2003 and load (or create) your project
  • On the Debug menu, select Exceptions (or use Ctrl+Alt+E from the keyboard)
  • Select the Common Language Runtime Exceptions node in the list
  • Click the Add... button
  • In the New Common Language Runtime Exceptions dialog
    • Enter the fully qualified name (ex: MyNamespace.CustomException) for your exception
    • Click the OK button

Visual Studio 2005
In Visual Studio 2005, the steps are very similar to those used in Visual Studio .NET 2003.

  • Start Visual Studio 2005 and load (or create) your project
  • On the Debug menu, select Exceptions (or use Ctrl+Alt+E from the keyboard)
  • Click the Add... button
  • In the New Exception dialog
    • Set the Type value to Common Language Runtime Exceptions
    • Enter the fully qualified name (ex: MyNamespace.CustomException) for your exception in the Name field
    • Click the OK button

Once your project's exception types have been added in the Exceptions dialog, you can configure how the Visual Studio debugger handles them (ex: stop on first chance exception).

Enjoy!
-- DK

[Edit: add link]

Disclaimer(s):
This posting is provided "AS IS" with no warranties, and confers no rights.
Some of the information contained within this post may be in relation to beta software. Any and all details are subject to change.