roslynator icon indicating copy to clipboard operation
roslynator copied to clipboard

Add analyzer for missing CancellationToken

Open thomaslevesque opened this issue 6 years ago • 0 comments
trafficstars

When a method that has a CancellationToken parameter calls another method without passing the cancellation token, it's usually a mistake. For instance:

private async Task FooAsync(CancellationToken cancellationToken = default)
{
    ...
    await BarAsync(); // Cancellation token should be passed to BarAsync, but is not
    ...
}

private async Task BarAsync(CancellationToken cancellationToken = default)
{
    ...
}

An analyzer and quick fix for this would be useful.

(ReSharper has an inspection for this)

thomaslevesque avatar Sep 17 '19 15:09 thomaslevesque