A method takes a CancellationToken and never uses it, so cancelling has no effect

tx0/csharp:unused-cancellation-tokenstrictwarningmaintainability/dead-codedepth fastsmell

What it finds

A caller that passes a token expects the work to stop when it is cancelled. A method that accepts the token and neither checks it nor hands it on ignores the request. Overrides, abstract and interface members, and methods with an empty body are left alone, since their signature is often given by someone else.

From the rule's source, unused_cancellation_token.rs.

Example from the rule's tests
using System.Threading;using System.Threading.Tasks; class Downloader{    async Task Get(CancellationToken token)tx0 reports: the token token is never used    {        await Task.Delay(10);    }     async Task Fetch(CancellationToken token)    {        await Task.Delay(10, token);    }}
Highlighted lines are the ones tx0 reports, with its message under each; the other lines are left alone.

Turn it on, off or suppress it

The rule runs from the strict tier up. To turn it on in a lower tier, give it a level in tx0.toml:

tx0.toml
[rules]
"tx0/csharp:unused-cancellation-token" = "warning"

To keep one finding, suppress it with a reason. tx0 suppress ID --reason "..." writes the comment on the line before the code:

// tx0: ignore[tx0/csharp:unused-cancellation-token] reason="..."

tx0 explain tx0/csharp:unused-cancellation-token shows the same in the terminal. Found a false positive? Report it.