Environment.FailFast Method (String, Exception)
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.
Assembly: mscorlib (in mscorlib.dll)
- Type: System.String
A message that explains why the process was terminated, or a null reference (Nothing in Visual Basic) if no explanation is provided.
- Type: System.Exception
An exception that represents the error that caused the termination. This is typically the exception in a catch block.
This method terminates the process without running any active try/finally blocks or finalizers.
The FailFast 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 a null reference (Nothing in Visual Basic), or if exception is not thrown, this method operates the same as the FailFast(String) method overload.
Use the FailFast method instead of the Exit 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.
requires full trust for the immediate caller. This member cannot be used by partially trusted or transparent code.
Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.