Open costin-zaharia-sonarsource opened 3 years ago
From docs:
For methods that cannot be canceled, do not provide overloads that accept a cancellation token; this helps indicate to the caller whether the target method is actually cancelable.
This rule has the potential to raise a lot of false positives.
We should consider a second rule which checks the async method invocations and, if there are overloads with CancellationToken, will suggest using them.
Any information on this rule?
Source: https://community.sonarsource.com/t/c-asynchronous-methods-should-take-a-cancellationtoken/42190 Microsoft docs: https://docs.microsoft.com/en-us/dotnet/standard/asynchronous-programming-patterns/task-based-asynchronous-pattern-tap#cancellation-optional