Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Check CancellationToken before TimeSpan in TimeProviderTaskExtensions - #107009

#107009
Merged
tarekgh merged 3 commits into
dotnet:maindotnet/runtime:mainfrom
brantburnett:time-provider-delaybrantburnett/runtime:time-provider-delayCopy head branch name to clipboard
Sep 5, 2024
Merged

Check CancellationToken before TimeSpan in TimeProviderTaskExtensions#107009
tarekgh merged 3 commits into
dotnet:maindotnet/runtime:mainfrom
brantburnett:time-provider-delaybrantburnett/runtime:time-provider-delayCopy head branch name to clipboard

Conversation

@brantburnett

Copy link
Copy Markdown
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
Comment thread src/libraries/Common/tests/System/TimeProviderTests.cs Outdated
Comment thread src/libraries/Common/tests/System/TimeProviderTests.cs Outdated
@tarekgh

tarekgh commented Sep 4, 2024

Copy link
Copy Markdown
Member

CC @stephentoub

@tarekgh

tarekgh commented Sep 5, 2024

Copy link
Copy Markdown
Member

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

@tarekgh
tarekgh merged commit 36e6b42 into dotnet:main Sep 5, 2024
@tarekgh

tarekgh commented Sep 5, 2024

Copy link
Copy Markdown
Member

Thanks @brantburnett for your help with this change.

@tarekgh

tarekgh commented Sep 5, 2024

Copy link
Copy Markdown
Member

/backport to release/9.0

@github-actions

github-actions Bot commented Sep 5, 2024

Copy link
Copy Markdown
Contributor

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 <10833894+tarekgh@users.noreply.github.com>
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 <10833894+tarekgh@users.noreply.github.com>
@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

Morty Proxy This is a proxified and sanitized view of the page, visit original site.