Code inspection: Method has async overload with cancellation support
This inspection reports a synchronous call inside an async context when there is an async overload that also accepts a CancellationToken.
This is the stronger version of the async-overload suggestion: the available async API also supports cooperative cancellation, so that token can be propagated.
Example
using System.Threading;
using System.Threading.Tasks;
public class Example
{
public void Load() { }
public Task LoadAsync(CancellationToken token) => Task.CompletedTask;
public async Task RunAsync(CancellationToken token)
{
Load();
}
}
using System.Threading;
using System.Threading.Tasks;
public class Example
{
public void Load() { }
public Task LoadAsync(CancellationToken token) => Task.CompletedTask;
public async Task RunAsync(CancellationToken token)
{
await LoadAsync(token);
}
}
Quick-fix
Switch to the async overload, pass an available CancellationToken, and add await.
28 March 2026