Modifica

Condividi tramite


TaskCompletionSource<TResult>.SetException Method

Definition

Transitions the underlying Task<TResult> object into the Faulted state.

Overloads

SetException(IEnumerable<Exception>)

Transitions the underlying Task<TResult> into the Faulted state and binds a collection of exception objects to it.

SetException(Exception)

Transitions the underlying Task<TResult> into the Faulted state and binds it to a specified exception.

SetException(IEnumerable<Exception>)

Source:
TaskCompletionSource_T.cs
Source:
TaskCompletionSource_T.cs
Source:
TaskCompletionSource_T.cs

Transitions the underlying Task<TResult> into the Faulted state and binds a collection of exception objects to it.

public:
 void SetException(System::Collections::Generic::IEnumerable<Exception ^> ^ exceptions);
public void SetException (System.Collections.Generic.IEnumerable<Exception> exceptions);
member this.SetException : seq<Exception> -> unit
Public Sub SetException (exceptions As IEnumerable(Of Exception))

Parameters

exceptions
IEnumerable<Exception>

The collection of exceptions to bind to this Task<TResult>.

Exceptions

The Task was disposed.

The exceptions argument is null.

There are one or more null elements in exceptions.

The underlying Task<TResult> is already in one of the three final states: RanToCompletion, Faulted, or Canceled.

See also

Applies to

SetException(Exception)

Source:
TaskCompletionSource_T.cs
Source:
TaskCompletionSource_T.cs
Source:
TaskCompletionSource_T.cs

Transitions the underlying Task<TResult> into the Faulted state and binds it to a specified exception.

public:
 void SetException(Exception ^ exception);
public void SetException (Exception exception);
member this.SetException : Exception -> unit
Public Sub SetException (exception As Exception)

Parameters

exception
Exception

The exception to bind to this Task<TResult>.

Exceptions

The Task was disposed.

The exception argument is null.

The underlying Task<TResult> is already in one of the three final states: RanToCompletion, Faulted, or Canceled.

See also

Applies to