TplExtensions.NoThrowAwaitable(Task, Boolean) Method

Definition

Returns an awaitable for the specified task that will never throw, even if the source task faults or is canceled.

public static Microsoft.VisualStudio.Threading.TplExtensions.NoThrowTaskAwaitable NoThrowAwaitable (this System.Threading.Tasks.Task task, bool captureContext = true);
static member NoThrowAwaitable : System.Threading.Tasks.Task * bool -> Microsoft.VisualStudio.Threading.TplExtensions.NoThrowTaskAwaitable
<Extension()>
Public Function NoThrowAwaitable (task As Task, Optional captureContext As Boolean = true) As TplExtensions.NoThrowTaskAwaitable

Parameters

task
Task

The task whose completion should signal the completion of the returned awaitable.

captureContext
Boolean

if set to true the continuation will be scheduled on the caller's context; false to always execute the continuation on the threadpool.

Returns

An awaitable.

Applies to