CancellationToken cancellationToken;
IAsyncEnumeration<string> enumerable;
await foreach (var item in enumerable) // not compliant
{
}
await foreach (var item in enumerable.WithCancellation(cancellationToken)) // compliant
{
}
This rule only reports diagnostics when the calling method returns a Task
or a ValueTask
. MA0080 detects the same cases, but reports them even if applying a fix would require you to change the calling method's signature.