Sebastian
Sebastian

Reputation: 6493

How to prevent Visual Studio from reporting an caught exception?

In this piece of code (runs in a unit test under debugging)

try
{
    var process = Process.GetProcessById(ProcessID);

    _isRunningCache = WindowHandle != IntPtr.Zero
                 && User32.IsWindow(WindowHandle) && !process.HasExited
                 && process.Responding;
}
catch
{
    return Invalidate();
}

I receive a report for an exception occurred (I do have reporting of unhandled exceptions enabled), but nevertheless visual studio interrupts the process and reports the exeption in the following manner: visual studio exception report

What can I do to prevent this? (despite disabling reporting of unhandled exceptions)

Upvotes: 2

Views: 365

Answers (1)

Steve Morgan
Steve Morgan

Reputation: 13091

Go to Debug -> Exceptions and deselect any checkboxes in the 'Thrown' column.

Ensure the 'User-unhandled' is checked for Common Language Runtime Exceptions.

Upvotes: 3

Related Questions