Skip to content

DurableTaskExtensions.WhenAny(IReadOnlyList<ScheduledTask<TResult>>, CancellationToken)

WhenAny(IReadOnlyList<ScheduledTask<TResult>>, CancellationToken)

staticextension
View source
public static Task<ScheduledTask<TResult>> WhenAny<TResult>(this IReadOnlyList<ScheduledTask<TResult>> tasks, CancellationToken cancellationToken = default(CancellationToken))
Returns the first scheduled task whose response completes, including failed or canceled durable responses. Wait cancellation and transport failures are propagated, and losing waits are canceled without canceling the durable tasks. Candidates are captured when this method is called.

Parameters

tasksIReadOnlyList<ScheduledTask<TResult>>
cancellationTokenCancellationToken

Exceptions

System.ArgumentOutOfRangeException
tasks is empty.
System.InvalidOperationException
The host's wait for the selected task returned an incomplete response.