ExceptionHandling.SetUnhandledExceptionHandler Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Sets a handler for unhandled exceptions.
public:
static void SetUnhandledExceptionHandler(Func<Exception ^, bool> ^ handler);
public static void SetUnhandledExceptionHandler(Func<Exception,bool> handler);
static member SetUnhandledExceptionHandler : Func<Exception, bool> -> unit
Public Shared Sub SetUnhandledExceptionHandler (handler As Func(Of Exception, Boolean))
Parameters
Exceptions
handler is null.
A handler has already been set.
Remarks
The handler will be called when an unhandled exception occurs.
The handler should return true if the exception was handled, or false if it was not.
If the handler returns false, the exception will continue to propagate as unhandled.
The intent of this handler is to allow the user to handle unhandled exceptions gracefully when the runtime is being used in certain scenarios. Scenarios such as REPLs or game scripting that host plug-ins are not able to handle unhandled exceptions thrown by those plug-ins.