System.Threading.Tasks.Task.Exception Property

Gets the AggregateException that caused the System.Threading.Tasks.Task to end prematurely. If the System.Threading.Tasks.Task completed successfully or has not yet thrown any exceptions, this will return null.

Syntax

public AggregateException Exception { get; }

Value

Documentation for this section has not yet been entered.

Remarks

Tasks that throw unhandled exceptions store the resulting exception and propagate it wrapped in a AggregateException in calls to Task.Wait or in accesses to the Task.Exception property. Any exceptions not observed by the time the task instance is garbage collected will be propagated on the finalizer thread. For more information and an example, see Exception Handling (Task Parallel Library).

Requirements

Namespace: System.Threading.Tasks
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 4.0.0.0