If a method receives a CancellationToken and then later awaits on a method that has an overload that takes a CancellationToken that exactly matches the current called method, and it is not used, then raise a diagnostic and offer a fix to it.
This will raise a diagnostic:
async Task FooAync(CancellationToken cancellationToken)
{
await BarAsync();
}
async Task BarAync(CancellationToken cancellationToken)
{
}
It will be fixed to this:
async Task FooAync(CancellationToken cancellationToken)
{
await BarAsync(cancellationToken);
}
async Task BarAync(CancellationToken cancellationToken)
{
}
Diagnostic Id: CC0069
Severity: Warning
Style: Usage
If a method receives a
CancellationTokenand then later awaits on a method that has an overload that takes aCancellationTokenthat exactly matches the current called method, and it is not used, then raise a diagnostic and offer a fix to it.This will raise a diagnostic:
It will be fixed to this:
Diagnostic Id:
CC0069Severity:
WarningStyle:
Usage