Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to turn off "Break when exception is thrown" for custom exception types

I'm doing some debugging where I really want to have the "break when exception is thrown" option turned on. There's a third party assembly I rely on that regularly throws exceptions. Some of them, like SynchronizationLockException I can turn off via Debug -> Exceptions menu.

The problem is they also have some custom exception types. Is there anyway to turn those off?

like image 822
Jeff B Avatar asked May 08 '12 21:05

Jeff B


People also ask

How do I stop Visual Studio from breaking on exception?

To turn off stop on exceptions press " Ctrl + Alt + E ". This will open the Exceptions window . Untick "Common Language Runtime Exceptions - Thrown". That would prevent it from pausing from within the delegate, but not when it's rethrown on Wait .

How do I change my exception settings?

In the Exception Settings window (Debug > Windows > Exception Settings), expand the node for a category of exceptions, such as Common Language Runtime Exceptions. Then select the check box for a specific exception within that category, such as System. AccessViolationException.


3 Answers

In the Debug > Exceptions dialog, click Add, select Common Language Runtime exceptions, and enter the full name (not the assembly-qualified name) of the exception. Then uncheck the Thrown checkbox for this exception.

like image 163
Thomas Levesque Avatar answered Oct 23 '22 00:10

Thomas Levesque


In Visual Studio 2019, when the exception occurs, there will be an information dialog.

Just un-check "Break when this exception type is user-unhandled".

exception dialog

like image 42
Andrew Avatar answered Oct 22 '22 22:10

Andrew


I think that you can try to uncheck this option <All Common Language Runtime Exceptions not in this list>:

Uncheck

In this case, most .NET Framework built-in exceptions will break but not those custom exception types which do not appear in the list.

Should you find some more exception types that you wish to break, you can right click on the Common Language Runtime Exceptions and then add more types to break:

Add types to break

like image 3
victor6510 Avatar answered Oct 22 '22 22:10

victor6510