ExceptionExtensions IsFatal Method Delta Engine Documentation

Namespace: DeltaEngine.Extensions
Assembly: DeltaEngine (in DeltaEngine.dll) Version: 1.1.1.0 (1.1.1)
Syntax

public static bool IsFatal(
	this Exception anyException
)

Return Value

Type: Boolean

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type Exception. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
Remarks

Tests: DeltaEngine.Tests.Extensions.ExceptionExtensionsTests
Examples

2 unit tests call DeltaEngine.Extensions.ExceptionExtensions.IsFatal(System.Exception)
[Test]
public void CheckForFatalException()
{
    Assert.IsFalse(new Exception().IsFatal());
    Assert.IsTrue(new Exception("", new InvalidOperationException()).IsFatal());
    Assert.IsTrue(new InvalidOperationException().IsFatal());
    Assert.IsTrue(new OutOfMemoryException().IsFatal());
    Assert.IsTrue(new AccessViolationException().IsFatal());
    Assert.IsTrue(new StackOverflowException().IsFatal());
    Assert.IsTrue(new TargetInvocationException(null).IsFatal());
    Assert.IsFalse(new NullReferenceException(null).IsFatal());
}
[Test]
public void MakeSureFatalExceptionsAreRethrown()
{
    try
    {
        TryMakeSureFatalExceptionsAreRethrown();
    } // ncrunch: no coverage 
    catch (Exception ex)
    {
        Assert.IsTrue(ex.IsFatal());
    }
}
See Also