ExceptionDispatchInfo 类

定义

表示在代码中的某个特定点捕获其状态的异常。Represents an exception whose state is captured at a certain point in code.

public ref class ExceptionDispatchInfo sealed
public sealed class ExceptionDispatchInfo
type ExceptionDispatchInfo = class
Public NotInheritable Class ExceptionDispatchInfo
继承
ExceptionDispatchInfo

注解

ExceptionDispatchInfo对象存储异常在捕获时所包含的堆栈跟踪信息和 Watson 信息。The ExceptionDispatchInfo object stores the stack trace information and Watson information that the exception contains at the point where it is captured. 异常可以在另一次引发,还可以通过调用 ExceptionDispatchInfo.Throw 方法引发。The exception can be thrown at another time and possibly on another thread by calling the ExceptionDispatchInfo.Throw method. 异常的引发方式是它从捕获到该方法的捕获点流向 ThrowThe exception is thrown as if it had flowed from the point where it was captured to the point where the Throw method is called.

ExceptionDispatchInfo 无法进行序列化,并且不用于跨应用程序域边界。ExceptionDispatchInfo cannot be serialized and is not intended to cross application domain boundaries.

属性

SourceException

获取被当前实例表示的异常。Gets the exception that is represented by the current instance.

方法

Capture(Exception)

创建 ExceptionDispatchInfo 对象,此对象在代码当前点表示指定异常。Creates an ExceptionDispatchInfo object that represents the specified exception at the current point in code.

Equals(Object)

确定指定对象是否等于当前对象。Determines whether the specified object is equal to the current object.

(继承自 Object)
GetHashCode()

作为默认哈希函数。Serves as the default hash function.

(继承自 Object)
GetType()

获取当前实例的 TypeGets the Type of the current instance.

(继承自 Object)
MemberwiseClone()

创建当前 Object 的浅表副本。Creates a shallow copy of the current Object.

(继承自 Object)
SetCurrentStackTrace(Exception)

将当前堆栈跟踪存储到指定的 Exception 实例中。Stores the current stack trace into the specified Exception instance.

Throw()

恢复捕获异常时保存的状态后,引发由当前 ExceptionDispatchInfo 对象表示的异常。Throws the exception that is represented by the current ExceptionDispatchInfo object, after restoring the state that was saved when the exception was captured.

Throw(Exception)

引发源异常,同时保留原始 Watson 信息,并增加(而不是替换)原始堆栈跟踪。Throws the source exception, maintaining the original Watson information and augmenting rather than replacing the original stack trace.

ToString()

返回表示当前对象的字符串。Returns a string that represents the current object.

(继承自 Object)

适用于