Search code examples
c#exceptioncustom-exceptions

Stopping "not handled in user code" dialog for exception type


Within visual studio I get an dialog saying something like

"An exception of type XXX occurred in YYY.dll but was not handled in user code"

and pausing my code. Is there a way in VS2013 of suppressing this just for this one exception type (this is for a custom exception)?


Solution

  • Yes, handle the exception.

    Either:

    • fix the issue (like in the case of an ArgumentNullException or IndexOutOfRangeException);
    • or if it is something you could expect: use a try...catch block (like internet being down causing an exception).

    If you want to disable messages on handled exceptions, you can set when if Visual Studio breaks on a specific exception in the Debug > Exceptions dialog. Then uncheck Thrown for your specific exception.