Code inspection: Method supports cancellation
This inspection reports a call where another overload of the same method accepts a CancellationToken, and a suitable token is already available in the current scope.
This helps propagate cancellation through an existing async or cooperative-cancellation flow.
Example
using System.Threading;
public class Example
{
public void Load() { }
public void Load(CancellationToken token) { }
public void Run(CancellationToken token)
{
Load();
}
}
using System.Threading;
public class Example
{
public void Load() { }
public void Load(CancellationToken token) { }
public void Run(CancellationToken token)
{
Load(token);
}
}
Quick-fix
Pass an available CancellationToken to the overload that supports cancellation.
28 March 2026