You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently rule CA2016 appears to be limited to cases where the containing method has a CancellationToken as a parameter. However, there are cases where a CancellationToken is available some other way (i.e. code analyzer's AnalysisContext).
It's also a signal to refactor when code is calling methods that take CancellationTokens but no token is available.
Analyzer
Diagnostic ID: CA2016
Describe the improvement
Currently rule CA2016 appears to be limited to cases where the containing method has a
CancellationToken
as a parameter. However, there are cases where a CancellationToken is available some other way (i.e. code analyzer's AnalysisContext).It's also a signal to refactor when code is calling methods that take CancellationTokens but no token is available.
Describe suggestions on how to achieve the rule
Here's a good blog post that shows additional cases that can be caught: https://www.meziantou.net/detect-missing-cancellationtoken-using-a-roslyn-analyzer.htm
Additional context
I'm happy to take a first pass at this, but wanted to make sure this wasn't already considered and rejected.
The text was updated successfully, but these errors were encountered: