WaitAsync(TimeSpan, CancellationToken)
public Task<TResult> WaitAsync(TimeSpan timeout, CancellationToken cancellationToken = default(CancellationToken)) Waits for and returns the successful result, 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
The task's result, including a result which it returns after observing the timeout's cancellation request.
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.
