dotnet/runtime

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

Open

#78.397 aperta il 15 nov 2022

Vedi su GitHub
 (7 commenti) (11 reazioni) (1 assegnatario)C# (5445 fork)batch import
api-approvedarea-System.Threading.Taskscode-analyzerhelp wanted

Metriche repository

Star
 (17.886 star)
Metriche merge PR
 (Merge medio 12g 11h) (661 PR mergiate in 30 g)

Descrizione

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.

Guida contributor