Share via

How to: Break on User-Unhandled Exceptions

If you are debugging with Just Mode Code, you can tell the debugger to break on any exception that is not handled by a handler in user code ("My Code"). The following procedure shows you how to use the Exceptions dialog box to determine which user-unhandled exceptions you want to break on.

While Using the Exceptions Dialog Box

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


The Exceptions dialog box provides keys for setting controls without using the mouse. The hot keys are indicated by underlining in the control labels. If you have Windows themes disabled, the underlining will not be visible, although hot keys will still work. To view the hot-key underlining, enable Windows themes using the Windows Control Panel.

For more information, see How to: Add New Exceptions and How to: Delete User-Added Exceptions.

To break when an exception is not handled by My Code

  1. On the Debug menu, click Exceptions.


    To enable the Exceptions menu in Express versions, on the Tools menu, click Settings, and then select Expert Settings.

  2. In the Exceptions dialog box, select User-unhandled for an entire category of exceptions, for example, Common Language Runtime Exceptions.


    Expand the node for a category of exceptions, for example, Common Language Runtime Exceptions, and select User-unhandled for a specific exception within that category.

  3. Click OK.

See Also


How to: Break When an Exception is Thrown


Exception Handling (Debugging)

Other Resources

Restrict stepping to Just My Code