Freigeben über


AwaitExtensions.ConfigureAwaitForAggregateException(Task, Boolean) Method

Definition

Returns an awaitable that will throw AggregateException from the Exception property of the task if it faults.

public static Microsoft.VisualStudio.Threading.AwaitExtensions.AggregateExceptionAwaitable ConfigureAwaitForAggregateException (this System.Threading.Tasks.Task task, bool continueOnCapturedContext = true);
static member ConfigureAwaitForAggregateException : System.Threading.Tasks.Task * bool -> Microsoft.VisualStudio.Threading.AwaitExtensions.AggregateExceptionAwaitable
<Extension()>
Public Function ConfigureAwaitForAggregateException (task As Task, Optional continueOnCapturedContext As Boolean = true) As AwaitExtensions.AggregateExceptionAwaitable

Parameters

task
Task

The task to track for completion.

continueOnCapturedContext
Boolean

Returns

An awaitable that may throw AggregateException.

Exceptions

Thrown when task faults.

Remarks

Awaiting a Task with its default TaskAwaiter only throws the first exception within InnerExceptions. When you do not want to lose the detail of other inner exceptions, use this extension method.

Applies to