TaskCompletionSource.TrySetException 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.
Overloads
| TrySetException(IEnumerable<Exception>) |
Attempts to transition the underlying Task into the Faulted state. |
| TrySetException(Exception) |
Attempts to transition the underlying Task into the Faulted state. |
TrySetException(IEnumerable<Exception>)
- Source:
- TaskCompletionSource.cs
- Source:
- TaskCompletionSource.cs
- Source:
- TaskCompletionSource.cs
- Source:
- TaskCompletionSource.cs
public:
bool TrySetException(System::Collections::Generic::IEnumerable<Exception ^> ^ exceptions);
public bool TrySetException(System.Collections.Generic.IEnumerable<Exception> exceptions);
member this.TrySetException : seq<Exception> -> bool
Public Function TrySetException (exceptions As IEnumerable(Of Exception)) As Boolean
Parameters
- exceptions
- IEnumerable<Exception>
The collection of exceptions to bind to this Task.
Returns
true if the operation was successful; otherwise, false.
Exceptions
exceptions is null.
There are one or more null elements in exceptions.
The exceptions collection is empty.
Remarks
This operation will return false if the Task is already in one of the three final states:
RanToCompletion, Faulted, or Canceled.
Applies to
TrySetException(Exception)
- Source:
- TaskCompletionSource.cs
- Source:
- TaskCompletionSource.cs
- Source:
- TaskCompletionSource.cs
- Source:
- TaskCompletionSource.cs
public:
bool TrySetException(Exception ^ exception);
public bool TrySetException(Exception exception);
member this.TrySetException : Exception -> bool
Public Function TrySetException (exception As Exception) As Boolean
Parameters
Returns
true if the operation was successful; otherwise, false.
Exceptions
exception is null.
Remarks
This operation will return false if the Task is already in one of the three final states:
RanToCompletion, Faulted, or Canceled.