Skip to content

Conversation

brantburnett
Copy link
Contributor

This makes the down-level behavior for Delay and WaitAsync match the behavior in .NET 8 and later, prefering to return a Canceled task over a Completed task or TimeoutException when the TimeSpan is Zero and the CancellationToken is already Canceled.

Fixes #106996

…sions

This makes the down-level behavior for Delay and WaitAsync match the
behavior in .NET 8 and later, prefering to return a Canceled task over
a Completed task or TimeoutException when the TimeSpan is Zero and the
CancellationToken is already Canceled.

Fixes dotnet#106996
@dotnet-policy-service dotnet-policy-service bot added the community-contribution Indicates that the PR has been added by a community member label Aug 27, 2024
@ericstj ericstj requested a review from tarekgh September 4, 2024 03:42
@tarekgh tarekgh added this to the 10.0.0 milestone Sep 4, 2024
@tarekgh tarekgh self-assigned this Sep 4, 2024
@tarekgh
Copy link
Member

tarekgh commented Sep 4, 2024

CC @stephentoub

@tarekgh
Copy link
Member

tarekgh commented Sep 5, 2024

/ba-g the failing test looks infrastructure without any logs.

@tarekgh tarekgh merged commit 36e6b42 into dotnet:main Sep 5, 2024
2 checks passed
@tarekgh
Copy link
Member

tarekgh commented Sep 5, 2024

Thanks @brantburnett for your help with this change.

@tarekgh
Copy link
Member

tarekgh commented Sep 5, 2024

/backport to release/9.0

@github-actions
Copy link
Contributor

github-actions bot commented Sep 5, 2024

Started backporting to release/9.0: https://github.com/dotnet/runtime/actions/runs/10725729170

@brantburnett brantburnett deleted the time-provider-delay branch September 13, 2024 12:40
jtschuster pushed a commit to jtschuster/runtime that referenced this pull request Sep 17, 2024
…dotnet#107009)

* Check CancellationToken before TimeSpan.Zero in TimeProviderTaskExtensions

This makes the down-level behavior for Delay and WaitAsync match the
behavior in .NET 8 and later, prefering to return a Canceled task over
a Completed task or TimeoutException when the TimeSpan is Zero and the
CancellationToken is already Canceled.

Fixes dotnet#106996

* Test improvements based on feedback

---------

Co-authored-by: Tarek Mahmoud Sayed <[email protected]>
sirntar pushed a commit to sirntar/runtime that referenced this pull request Sep 30, 2024
…dotnet#107009)

* Check CancellationToken before TimeSpan.Zero in TimeProviderTaskExtensions

This makes the down-level behavior for Delay and WaitAsync match the
behavior in .NET 8 and later, prefering to return a Canceled task over
a Completed task or TimeoutException when the TimeSpan is Zero and the
CancellationToken is already Canceled.

Fixes dotnet#106996

* Test improvements based on feedback

---------

Co-authored-by: Tarek Mahmoud Sayed <[email protected]>
@github-actions github-actions bot locked and limited conversation to collaborators Oct 14, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-System.DateTime community-contribution Indicates that the PR has been added by a community member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Down-level TimeProviderTaskExtensions CancellationToken behavior is inconsistent with Task

4 participants