WaitAsync(TimeSpan, CancellationToken)
public Task WaitAsync(TimeSpan timeout, CancellationToken cancellationToken = default(CancellationToken)) Waits for successful completion, and requests durable cancellation of the task once
timeout elapses. Parameters
timeoutTimeSpan- The time to wait before requesting cancellation, which is zero or positive.
cancellationTokenCancellationToken- A token which abandons the wait. It doesn't cancel the task.
Returns
An operation which completes once the task is terminal.
Exceptions
System.ArgumentOutOfRangeExceptiontimeoutis negative, includingSystem.Threading.Timeout.InfiniteTimeSpan; await the task to wait without a timeout. Outside a durable execution,timeoutalso exceeds the longest timer interval whichSystem.Threading.CancellationTokenSource.CancelAfteraccepts.System.TimeoutException- The timeout elapsed, and the task ended canceled.
