Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
stephentoub opened this issue Nov 15, 2022 · 4 comments
Open

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

stephentoub opened this issue Nov 15, 2022 · 4 comments
Assignees
Labels
api-approved API was approved in API review, it can be implemented area-System.Threading.Tasks code-analyzer Marks an issue that suggests a Roslyn analyzer
Milestone

Comments

@stephentoub
Copy link
Member

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.

@stephentoub stephentoub added the code-analyzer Marks an issue that suggests a Roslyn analyzer label Nov 15, 2022
@ghost ghost added the untriaged New issue has not been triaged by the area owner label Nov 15, 2022
@ghost
Copy link

ghost commented Nov 15, 2022

Tagging subscribers to this area: @dotnet/area-system-threading-tasks
See info in area-owners.md if you want to be subscribed.

Issue Details

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.

Author: stephentoub
Assignees: -
Labels:

area-System.Threading.Tasks, code-analyzer

Milestone: -

@buyaa-n buyaa-n added this to the 8.0.0 milestone Nov 16, 2022
@ghost ghost removed the untriaged New issue has not been triaged by the area owner label Nov 16, 2022
@stephentoub stephentoub added the api-suggestion Early API idea and discussion, it is NOT ready for implementation label Nov 21, 2022
@stephentoub stephentoub added api-ready-for-review API is ready for review, it is NOT ready for implementation and removed api-suggestion Early API idea and discussion, it is NOT ready for implementation labels Jan 20, 2023
@bartonjs
Copy link
Member

bartonjs commented Mar 7, 2023

Video

Looks good as proposed (finding Task-like returning method groups with no overloads that accept a CancellationToken).

Category: Design
Severity: None (off by default)

@bartonjs bartonjs added api-approved API was approved in API review, it can be implemented and removed api-ready-for-review API is ready for review, it is NOT ready for implementation labels Mar 7, 2023
@buyaa-n buyaa-n added the help wanted [up-for-grabs] Good issue for external contributors label May 4, 2023
@pedrodeandrade
Copy link

I would like to be assigned to this, please

@buyaa-n
Copy link
Contributor

buyaa-n commented Jul 28, 2023

Thanks @pedrodeandrade, assigned to you

@buyaa-n buyaa-n removed the help wanted [up-for-grabs] Good issue for external contributors label Jul 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api-approved API was approved in API review, it can be implemented area-System.Threading.Tasks code-analyzer Marks an issue that suggests a Roslyn analyzer
Projects
None yet
Development

No branches or pull requests

5 participants