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

fix: Task Scheduler Queue Task called when SychronizationContext disposed #3451

Merged
merged 4 commits into from
Dec 31, 2024

Conversation

iancooper
Copy link
Member

In our synchronization context, when we complete adding tasks, we pump the pending continuations in the queue.

We expect to then restore the old synchronization context

In some cases, we get an issue where we are then handed another continuation via the scheduler. The blockingcollection is complete, and even it it was not, nothing will pump the continuations.

(We can reproduce thanks to @rafael Andrade by using a Task.Delay())

In this case, we just use a "Hail Mary" approach (cribbed from RavenDb) of putting the queued task on a new thread.

@iancooper iancooper added 3 - Done Bug v10 Allocal to a v10 release .NET Pull requests that update .net code labels Dec 31, 2024
Copy link

@codescene-delta-analysis codescene-delta-analysis bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Health Quality Gates: FAILED

Change in average Code Health of affected files: -0.17 (9.17 -> 9.01)

  • Declining Code Health: 1 findings(s) 🚩

View detailed results in CodeScene

@iancooper iancooper merged commit d91839e into master Dec 31, 2024
5 of 6 checks passed
@iancooper iancooper deleted the sync_await_false_fix branch December 31, 2024 18:34
Copy link

@codescene-delta-analysis codescene-delta-analysis bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Health Quality Gates: OK

Change in average Code Health of affected files: +0.03 (8.98 -> 9.01)

View detailed results in CodeScene

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3 - Done Bug .NET Pull requests that update .net code v10 Allocal to a v10 release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant