dotnet/runtime

[Analyzer] Async methods that don't take a CancellationToken

Open

#78.397 geöffnet am 15. Nov. 2022

Auf GitHub ansehen
 (7 Kommentare) (11 Reaktionen) (1 zugewiesene Person)C# (5.445 Forks)batch import
api-approvedarea-System.Threading.Taskscode-analyzerhelp wanted

Repository-Metriken

Stars
 (17.886 Stars)
PR-Merge-Metriken
 (Durchschn. Merge 12T 11h) (661 gemergte PRs in 30 T)

Beschreibung

Cancellation is often important to the scalability of an app / service. If an async method has no way to cancel it, that can impact scalability and responsiveness. We should consider adding an analyzer (likely off by default due to noise) that flags async methods (async and/or Task/ValueTask-returning) that have no overloads which accept a CancellationToken, and issue a diagnostic to consider taking one.

Contributor Guide