How to: Add New Exceptions
This topic applies to:
Edition |
Visual Basic |
C# |
C++ |
Web Developer |
---|---|---|---|---|
Express |
||||
Standard |
||||
Pro and Team |
Table legend:
Applies |
|
Does not apply |
|
Command or commands hidden by default. |
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
In the Exceptions dialog box, click the Add button.
In the New Exception dialog box, choose a category of exceptions from the Type list.
Type the name of the exception in the Name box.
Exception names are not case sensitive, so "CustomException" and "customexception" represent the same exception.
Click OK.
See Also
Tasks
How to: Break When an Exception is Thrown
How to: Break on User-Unhandled Exceptions