JetBrains Rider 2026.1 Help

Code inspection: Use cancellation token

This inspection reports an IAsyncEnumerable consumption site where a cancellation token is available but not used. For async streams, passing the token with WithCancellation(...) makes cancellation behavior explicit.

Example

await foreach (var item in source) { Process(item); }
await foreach (var item in source.WithCancellation(token)) { Process(item); }

Quick-fix

Append WithCancellation(...) and pass an available cancellation token.

29 March 2026