# DurableTaskExtensions.WaitAsync(DurableTask&lt;TResult&gt;, TimeSpan)

[Type overview](/orleans/docs/api/csharp/microsoft.orleans.durable.abstractions/orleans.durable.tasks.durabletaskextensions/) | [Methods](/orleans/docs/api/csharp/microsoft.orleans.durable.abstractions/orleans.durable.tasks.durabletaskextensions/methods/)

[Source](https://github.com/dotnet/orleans/blob/6a0e937f544c35ffcf11b37e4c2b7de5a1580a03/src/Orleans.Durable.Abstractions/DurableTaskExtensions.cs)

```csharp
public static DurableTask<TResult> WaitAsync<TResult>(this DurableTask<TResult> task, TimeSpan timeout)
```

Creates a durable task which runs `task`, returns its result, and requests its durable cancellation once `timeout` elapses.

### Parameters

- `task` (`DurableTask<TResult>`): The task to run.
- `timeout` (`TimeSpan`): The time to wait before requesting cancellation, which is zero or positive.

### Returns

A combinator which, awaited within a durable execution, runs as part of that execution and completes once `task` is terminal.

### Exceptions

- `System.ArgumentNullException`: `task` is `null`.
- `System.ArgumentOutOfRangeException`: `timeout` is negative, including `System.Threading.Timeout.InfiniteTimeSpan`; await the task itself to wait without a timeout.
