Capture Method
Collapse the table of content
Expand the table of content

ExceptionDispatchInfo.Capture Method (Exception)

.NET Framework (current version)
 

Creates an ExceptionDispatchInfo object that represents the specified exception at the current point in code.

Namespace:   System.Runtime.ExceptionServices
Assembly:  mscorlib (in mscorlib.dll)

public static ExceptionDispatchInfo Capture(
	Exception source
)

Parameters

source
Type: System.Exception

The exception whose state is captured, and which is represented by the returned object.

Return Value

Type: System.Runtime.ExceptionServices.ExceptionDispatchInfo

An object that represents the specified exception at the current point in code.

Exception Condition
ArgumentException

source is null.

You can use the ExceptionDispatchInfo object that is returned by this method at another time and possibly on another thread to rethrow the specified exception, as if the exception had flowed from this point where it was captured to the point where it is rethrown.

If the exception is active when it is captured, the current stack trace information and Watson information that is contained in the exception is stored. If it is inactive, that is, if it has not been thrown, it will not have any stack trace information or Watson information.

Universal Windows Platform
Available since 4.5
.NET Framework
Available since 4.5
Portable Class Library
Supported in: portable .NET platforms
Windows Phone Silverlight
Available since 8.0
Windows Phone
Available since 8.1
Return to top
Show:
© 2016 Microsoft