System.Environment.FailFast Method

Immediately terminates a process after writing a message to the Windows Application event log, and then includes the message and exception information in error reporting to Microsoft.

Syntax

[System.Security.SecurityCritical]
public static void FailFast (string message, Exception exception)

Parameters

message
A message that explains why the process was terminated, or null if no explanation is provided.
exception
An exception that represents the error that caused the termination. This is typically the exception in a catch block.

Remarks

This method terminates the process without running any active try/finally blocks or finalizers.

The Environment.FailFast(string, Exception) method writes the message string to the Windows Application event log, creates a dump of your application, and then terminates the current process.

Error reporting to Microsoft includes message and exception information, which provides details used to classify the error. Although exception is not handled because the process is terminated, the contextual information that raised the exception is still obtained.

If exception is null, or if exception is not thrown, this method operates the same as the Environment.FailFast(string) method overload.

Use the Environment.FailFast(string, Exception) method instead of the Environment.Exit(int) method to terminate your application if the state of your application is damaged beyond repair, and executing your application's try/finally blocks and finalizers will corrupt program resources.

Requirements

Namespace: System
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 4.0.0.0