Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revise our usage of return; after IsCancellationRequested check #5063

Open
Youssef1313 opened this issue Feb 18, 2025 · 0 comments
Open

Revise our usage of return; after IsCancellationRequested check #5063

Youssef1313 opened this issue Feb 18, 2025 · 0 comments
Labels
Area: MTP Belongs to the Microsoft.Testing.Platform core library

Comments

@Youssef1313
Copy link
Member

We often have this pattern:

if (_isServerMode || cancellationToken.IsCancellationRequested)
{
return Task.CompletedTask;
}

where would return immediately on cancellation. This pattern doesn't look right. Instead, we should call ThrowIfCancellationRequested()

@Youssef1313 Youssef1313 added the Area: MTP Belongs to the Microsoft.Testing.Platform core library label Feb 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: MTP Belongs to the Microsoft.Testing.Platform core library
Projects
None yet
Development

No branches or pull requests

1 participant