dotnet / dotnet/dotnet-api-docs
The statement that "TaskFactory.ContinueWhenAll method throws an exception" is not true
- Dominant language
- C#
- Stars
- 949
- Forks
- 1.7k
- Avg merge
- 3d 27m
- Merged PRs (30d)
- 49
Description
It's said on the [CancellationToken Struct page](https://docs.microsoft.com/en-us/dotnet/api/system.threading.cancellationtoken?view=netframework-4.8#examples) that
> ...method is called to ensure that the mean is computed only after all readings have been gathered successfully. If a task has not because it has been cancelled, the call to the `TaskFactory.ContinueWhenAll` method throws an exception.
In fact, the `TaskFactory.ContinueWhenAll` method does not throw an exception but merely returns a task in any scenario. The exception is thrown on the next line where `fTask.Result` is requested:
```C#
Console.WriteLine("The mean is {0}.", fTask.Result);
```
Contributor guide
Assessment
This issue has not been assessed yet.