Share via


How to: Add New Exceptions 

By default, the Exceptions dialog box lists the most common exceptions in each category. You can add other exceptions to a category. Visual Studio saves the list of added exceptions with the project data, so the exceptions will be available the next time you open and run the project.

The Exceptions dialog box provides limited support for generic exception types in C#, but not Visual Basic. To break on exceptions created from X.MyClass, for example, you must specify X.MyClass, not just MyClass. You can also enter X.MyClass`2 to stop on X.MyClass`2 but not X.MyClass`4.

To add an exception to the Exceptions dialog box

  1. In the Exceptions dialog box, click the Add button.

  2. In the New Exception dialog box, choose a category of exceptions from the Type list.

  3. Type the name of the exception in the Name box.

    Exception names are not case sensitive, so "CustomException" and "customexception" represent the same exception.

  4. Click OK.

See Also

Tasks

How to: Break When an Exception is Thrown
How to: Break on User-Unhandled Exceptions

Concepts

Exception Handling (Debugging)