dotnet / dotnet/dotnet-api-docs

Document the precise semantics of Parallel.ForEachAsync

Offen
#7,147 2 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
area-System.Threading.Tasks Pri3 untriaged
Vorherrschende Sprache
C#
Sterne
949
Forks
1.7k
Ø Merge
2 T. 19 Std.
Gemergte PRs (30 T.)
52

Beschreibung

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)

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Beginne mit der verlinkten aktuellen Dokumentation der Parallel.ForEachAsync API und dem ursprünglichen Issue #1946. Überprüfe jede aufgeführte Frage anhand der API und des Implementierungsverhaltens und dokumentiere anschließend die bestätigte Semantik von Ausnahmen, Abbruch, Parallelität, Reihenfolge, Partitionierung und Scheduler, damit sich Aufrufer auf präzise Hinweise verlassen können.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
csharp
Bereich
documentation
Issue-Typ
Dokumentation
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
50/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.