Jeff B
Jeff B

Reputation: 8972

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?

Upvotes: 35

Views: 22458

Answers (3)

victor6510
victor6510

Reputation: 1334

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

Upvotes: 4

Andrew
Andrew

Reputation: 20061

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

Upvotes: 10

Thomas Levesque
Thomas Levesque

Reputation: 292355

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.

Upvotes: 41

Related Questions