Environment.FailFast 메서드

정의

오류 메시지를 보고하기 전에 프로세스를 즉시 종료합니다. Windows 경우 오류 메시지가 Windows 애플리케이션 이벤트 로그에 기록되고 메시지 및 선택적 예외 정보가 Microsoft 오류 보고에 포함됩니다. Unix와 유사한 시스템의 경우 스택 추적과 함께 메시지가 표준 오류 스트림에 기록됩니다.

오버로드

Name Description
FailFast(String)

오류 메시지를 보고하기 전에 프로세스를 즉시 종료합니다. Windows 경우 오류 메시지가 Windows 애플리케이션 이벤트 로그에 기록되고 메시지는 Microsoft 오류 보고에 포함됩니다. Unix와 유사한 시스템의 경우 스택 추적과 함께 메시지가 표준 오류 스트림에 기록됩니다.

FailFast(String, Exception)

오류 메시지를 보고하기 전에 프로세스를 즉시 종료합니다. Windows 경우 오류 메시지가 Windows 애플리케이션 이벤트 로그에 기록되고 메시지 및 예외 정보가 Microsoft 오류 보고에 포함됩니다. Unix와 유사한 시스템의 경우 스택 추적과 함께 메시지가 표준 오류 스트림에 기록됩니다.

FailFast(String)

Source:
Environment.CoreCLR.cs
Source:
Environment.CoreCLR.cs
Source:
Environment.cs
Source:
Environment.cs
Source:
Environment.CoreCLR.cs

오류 메시지를 보고하기 전에 프로세스를 즉시 종료합니다. Windows 경우 오류 메시지가 Windows 애플리케이션 이벤트 로그에 기록되고 메시지는 Microsoft 오류 보고에 포함됩니다. Unix와 유사한 시스템의 경우 스택 추적과 함께 메시지가 표준 오류 스트림에 기록됩니다.

public:
 static void FailFast(System::String ^ message);
[System.Security.SecurityCritical]
public static void FailFast(string message);
public static void FailFast(string? message);
public static void FailFast(string message);
[<System.Security.SecurityCritical>]
static member FailFast : string -> unit
static member FailFast : string -> unit
Public Shared Sub FailFast (message As String)

매개 변수

message
String

프로세스가 종료된 이유 또는 null 설명이 제공되지 않는지 설명하는 메시지입니다.

특성

예제

다음은 Windows 실행 시 Windows Application 이벤트 로그에 로그 항목을 쓰거나 Unix와 유사한 시스템에서 실행 중일 때 표준 오류 스트림에 오류 메시지를 쓰고 현재 프로세스를 종료하는 예제입니다.

using System;

class Example
{
    public static void Main()
    {
       string causeOfFailure = "A catastrophic failure has occurred.";

       // Assume your application has failed catastrophically and must
       // terminate immediately. The try-finally block is not executed
       // and is included only to demonstrate that instructions within
       // try-catch blocks and finalizers are not performed.
       try
       {
           Environment.FailFast(causeOfFailure);
       }
       finally
       {
           Console.WriteLine("This finally block will not be executed.");
       }
   }
}
/*
The example produces no output because the application is terminated.
However, an entry is made in the Windows Application event log, and
the log entry contains the text from the causeOfFailure variable.
*/
open System

let causeOfFailure = "A catastrophic failure has occurred."

// Assume your application has failed catastrophically and must
// terminate immediately. The try-finally block is not executed
// and is included only to demonstrate that instructions within
// try-catch blocks and finalizers are not performed.
try
    Environment.FailFast causeOfFailure
finally
    printfn "This finally block will not be executed."

// The example produces no output because the application is terminated.
// However, an entry is made in the Windows Application event log, and
// the log entry contains the text from the causeOfFailure variable.
Module Example
    Public Sub Main()
        Dim causeOfFailure As String = "A catastrophic failure has occurred."
        ' Assume your application has failed catastrophically and must
        ' terminate immediately. The try-finally block is not executed 
        ' and is included only to demonstrate that instructions within 
        ' try-catch blocks and finalizers are not performed.

        Try
            Environment.FailFast(causeOfFailure)
        Finally
            Console.WriteLine("This finally block will not be executed.")
        End Try
    End Sub
End Module
'
' The code example displays no output because the application is
' terminated. However, an entry is made in the Windows Application event
' log, and the log entry contains the text from the causeOfFailure variable.

설명

이 메서드는 활성 try/finally 블록 또는 종료자를 실행하지 않고 프로세스를 종료합니다.

Windows Environment.FailFast 메서드는 Windows 애플리케이션 이벤트 로그에 message 문자열을 쓰고, 애플리케이션의 덤프를 만든 다음, 현재 프로세스를 종료합니다. message 문자열은 Windows 오류 보고를 통해 Microsoft 오류 보고에도 포함됩니다. 자세한 내용은 Windows 오류 보고: 시작 참조하세요.

Unix와 유사한 시스템에서 메시지는 스택 추적 정보와 함께 표준 오류 스트림에 기록됩니다.

Environment.FailFast 복구할 수 없을 정도로 애플리케이션 상태가 손상되고 애플리케이션의 Exit 블록 및 종료자를 실행하면 프로그램 리소스가 손상되는 경우 메서드 대신 메서드를 사용하여 애플리케이션 try/finally 을 종료합니다.

Visual Studio 디버거에서 실행되는 애플리케이션의 실행을 종료하기 위해 Environment.FailFast 메서드를 호출하면 ExecutionEngineException throw되고 fatalExecutionEngineError MDA(관리되는 디버깅 도우미) 자동으로 트리거됩니다.

적용 대상

FailFast(String, Exception)

Source:
Environment.CoreCLR.cs
Source:
Environment.CoreCLR.cs
Source:
Environment.cs
Source:
Environment.cs
Source:
Environment.CoreCLR.cs

오류 메시지를 보고하기 전에 프로세스를 즉시 종료합니다. Windows 경우 오류 메시지가 Windows 애플리케이션 이벤트 로그에 기록되고 메시지 및 예외 정보가 Microsoft 오류 보고에 포함됩니다. Unix와 유사한 시스템의 경우 스택 추적과 함께 메시지가 표준 오류 스트림에 기록됩니다.

public:
 static void FailFast(System::String ^ message, Exception ^ exception);
[System.Security.SecurityCritical]
public static void FailFast(string message, Exception exception);
public static void FailFast(string? message, Exception? exception);
public static void FailFast(string message, Exception exception);
[<System.Security.SecurityCritical>]
static member FailFast : string * Exception -> unit
static member FailFast : string * Exception -> unit
Public Shared Sub FailFast (message As String, exception As Exception)

매개 변수

message
String

프로세스가 종료된 이유 또는 null 설명이 제공되지 않는지 설명하는 메시지입니다.

exception
Exception

종료를 발생시킨 오류를 나타내는 예외입니다. 일반적으로 블록의 예외입니다 catch .

특성

설명

이 메서드는 활성 try/finally 블록 또는 종료자를 실행하지 않고 프로세스를 종료합니다.

Windows Environment.FailFast 메서드는 Windows 애플리케이션 이벤트 로그에 message 문자열을 쓰고, 애플리케이션의 덤프를 만든 다음, 현재 프로세스를 종료합니다.

정보는 Windows 오류 보고를 사용하여 Microsoft 보고됩니다. 자세한 내용은 Windows 오류 보고: 시작 참조하세요. Microsoft 오류 보고에는 오류를 분류하는 데 사용되는 세부 정보를 제공하는 messageexception 정보가 포함됩니다. 프로세스가 종료되어 처리되지는 않지만 exception 예외를 발생시킨 컨텍스트 정보는 여전히 가져옵니다.

Unix와 유사한 시스템에서 메시지는 스택 추적 정보와 함께 표준 오류 스트림에 기록됩니다.

exception경우 null 또는 throw되지 않은 경우 exception 이 메서드는 메서드 오버로드와 FailFast(String) 동일하게 작동합니다.

Environment.FailFast 복구할 수 없을 정도로 애플리케이션 상태가 손상되고 애플리케이션의 Exit 블록 및 종료자를 실행하면 프로그램 리소스가 손상되는 경우 메서드 대신 메서드를 사용하여 애플리케이션 try/finally 을 종료합니다.

Visual Studio 디버거에서 실행되는 애플리케이션의 실행을 종료하기 위해 Environment.FailFast 메서드를 호출하면 ExecutionEngineException throw되고 fatalExecutionEngineError MDA(관리되는 디버깅 도우미) 자동으로 트리거됩니다.

적용 대상