IsFatalException Method
Definition
IsFatalException(Exception)
Determines whether the specified exception is considered fatal and should not be swallowed.
public static bool IsFatalException(Exception exception)
Parameters
exceptionExceptionThe exception to evaluate.
Returns
- bool
trueifexceptionis a fatal runtime exception such as OutOfMemoryException, StackOverflowException, SEHException, AccessViolationException, ThreadAbortException or ThreadInterruptedException; otherwise,false.
Remarks
Designed for use as an exception filter: catch (Exception ex) when (!Patterns.IsFatalException(ex)) to prevent accidentally swallowing critical runtime exceptions.