TaskCompletionSource<TResult>.SetException Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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
反馈
https://aka.ms/ContentUserFeedback。
即将发布:在整个 2024 年,我们将逐步淘汰作为内容反馈机制的“GitHub 问题”,并将其取代为新的反馈系统。 有关详细信息,请参阅:提交和查看相关反馈