Export (0) Print
Expand All

ExceptionDispatchInfo.Capture Method

.NET Framework 4.5

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


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.


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.

.NET Framework

Supported in: 4.5

.NET for Windows Store apps

Supported in: Windows 8

.NET for Windows Phone apps

Supported in: Windows Phone 8.1, Windows Phone Silverlight 8.1, Windows Phone Silverlight 8

Windows Phone 8.1, Windows Phone 8, 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.

© 2014 Microsoft