trigger_segfault
trigger_segfault

Reputation: 604

Disable Console output of all Handled/Caught Exceptions in Visual Studio

I'm currently using a library that throws (and handles) about 5 exceptions when a request to get something fails. Normally this isn't a problem since it's expected this might happen, but the problem is that Visual Studio will log these exceptions anyway.

Is there a way to disable Visual Studio from outputting caught exceptions to the debug console? I still want all other exceptions that would cause a break to be logged.

Upvotes: 4

Views: 2037

Answers (1)

Francesco B.
Francesco B.

Reputation: 3107

You can ask Visual Studio to care about the exceptions in your code only, using the Just My Code option.

Go to the "Debug" menu and click on "Options and Settings", and then Enable Just My Code:

Just My Code

This has been discussed on StackOverflow too.

Then, if the methods that are throwing the exception belong to a project that is... your code, you can decorate them with the DebuggerNonUserCode attribute:

DebuggerNonUserCode

which combined with the "Just My Code" option will produce the desired behaviour. More on the topic here.

Upvotes: 6

Related Questions