Skip to content

Commit 29ff220

Browse files
authored
Add behavior info for Environment.FailFast on non-Windows systems (#9490)
1 parent c13606c commit 29ff220

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

xml/System/Environment.xml

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -547,7 +547,7 @@ Invalid argument
547547
<AssemblyVersion>4.2.0.0</AssemblyVersion>
548548
</AssemblyInfo>
549549
<Docs>
550-
<summary>Immediately terminates a process after writing a message to the Windows Application event log, and then includes the message and optional exception information in error reporting to Microsoft.</summary>
550+
<summary>Immediately terminates the process before reporting an error message. For Windows, the error message is written to the Windows Application event log, and the message and optional exception information is included in error reporting to Microsoft. For Unix-like systems, the message, alongside the stack trace, is written to the standard error stream.</summary>
551551
</Docs>
552552
</MemberGroup>
553553
<Member MemberName="FailFast">
@@ -608,23 +608,23 @@ Invalid argument
608608
</Parameters>
609609
<Docs>
610610
<param name="message">A message that explains why the process was terminated, or <see langword="null" /> if no explanation is provided.</param>
611-
<summary>Immediately terminates a process after writing a message to the Windows Application event log, and then includes the message in error reporting to Microsoft.</summary>
611+
<summary>Immediately terminates the process before reporting an error message. For Windows, the error message is written to the Windows Application event log, and the message is included in error reporting to Microsoft. For Unix-like systems, the message, alongside the stack trace, is written to the standard error stream.</summary>
612612
<remarks>
613613
<format type="text/markdown"><![CDATA[
614614
615615
## Remarks
616616
This method terminates a process without running any active `try`/`finally` blocks or finalizers.
617617
618-
The `Environment.FailFast` method writes the `message` string to the Windows Application event log, creates a dump of your application, and then terminates the current process. The `message` string is also included in error reporting to Microsoft.
618+
On Windows, the `Environment.FailFast` method writes the `message` string to the Windows Application event log, creates a dump of your application, and then terminates the current process. The `message` string is also included in error reporting to Microsoft via Windows Error Reporting. For more information, see [Windows Error Reporting: Getting Started](/windows-hardware/drivers/dashboard/).
619+
620+
On Unix-like systems, the message is written to the standard error stream, alongside the stack trace information.
619621
620622
Use the `Environment.FailFast` method instead of the <xref:System.Environment.Exit%2A> 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.
621623
622-
Information is reported to Microsoft by using Windows Error Reporting. For more information, see [Windows Error Reporting: Getting Started](/windows-hardware/drivers/dashboard/).
623-
624624
Calling the `Environment.FailFast` method to terminate execution of an application running in the Visual Studio debugger throws an <xref:System.ExecutionEngineException> and automatically triggers the [fatalExecutionEngineError managed debugging assistant (MDA)](/dotnet/framework/debug-trace-profile/fatalexecutionengineerror-mda).
625625
626626
## Examples
627-
The following example writes a log entry to the Windows Application event log and terminates the current process.
627+
The following example writes a log entry to the Windows Application event log when running under Windows, or writes the error message to the standard error stream when running under a Unix-like system, and terminates the current process.
628628
629629
:::code language="csharp" source="~/snippets/csharp/System/Environment/FailFast/ff.cs" id="Snippet1":::
630630
:::code language="fsharp" source="~/snippets/fsharp/System/Environment/FailFast/ff.fs" id="Snippet1":::
@@ -693,16 +693,18 @@ Calling the `Environment.FailFast` method to terminate execution of an applicati
693693
<Docs>
694694
<param name="message">A message that explains why the process was terminated, or <see langword="null" /> if no explanation is provided.</param>
695695
<param name="exception">An exception that represents the error that caused the termination. This is typically the exception in a <see langword="catch" /> block.</param>
696-
<summary>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.</summary>
696+
<summary>Immediately terminates the process before reporting an error message. For Windows, the error message is written to the Windows Application event log, and the message and exception information is included in error reporting to Microsoft. For Unix-like systems, the message alongside the stack trace is written to the standard error stream.</summary>
697697
<remarks>
698698
<format type="text/markdown"><![CDATA[
699699
700700
## Remarks
701701
This method terminates the process without running any active `try`/`finally` blocks or finalizers.
702702
703-
The `Environment.FailFast` method writes the `message` string to the Windows Application event log, creates a dump of your application, and then terminates the current process.
703+
On Windows, the `Environment.FailFast` method writes the `message` string to the Windows Application event log, creates a dump of your application, and then terminates the current process.
704704
705705
Information is reported to Microsoft by using Windows Error Reporting. For more information, see [Windows Error Reporting: Getting Started](/windows-hardware/drivers/dashboard/). 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.
706+
707+
On Unix-like systems, the message is written to the standard error stream, alongside the stack trace information.
706708
707709
If `exception` is `null`, or if `exception` is not thrown, this method operates the same as the <xref:System.Environment.FailFast%28System.String%29> method overload.
708710

0 commit comments

Comments
 (0)