Skip to content

Revise our usage of return; after IsCancellationRequested check #5063

@Youssef1313

Description

@Youssef1313

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()

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area: MTPBelongs to the Microsoft.Testing.Platform core library

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions