dotnet / dotnet/dotnet-api-docs
Document the precise semantics of Parallel.ForEachAsync
- Dominant language
- C#
- Stars
- 949
- Forks
- 1.7k
- Avg merge
- 3d 27m
- Merged PRs (30d)
- 49
Description
Currently, the documentation for `Parallel.ForEachAsync` is the bare-bones description of parameters and overloads. There are a lot of interesting semantics that a caller should know about:
- What happens in case of exceptions? I assume the loop is being aborted and an `AggregateException` is being thrown.
- Cancellation stops processing further items and signals the token passed to each running worker. Is an exception being thrown?
- The degree of parallelism specified is exact and is guaranteed (right?).
- Items are taken from the source one by one and not in batches. There is no range partitioning for lists and arrays (this is important).
- Items will be processed roughly in sequential order on a best-effort basis.
- The task scheduler can be specified.
I have distilled this from the original issue https://github.com/dotnet/runtime/issues/1946. [Current documentation.](https://docs.microsoft.com/en-us/dotnet/api/system.threading.tasks.parallel.foreachasync)
Contributor guide
Assessment
This issue has not been assessed yet.