Skip to content

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

Merged
iancooper merged 4 commits into
masterfrom
sync_await_false_fix
Dec 31, 2024
Merged

fix: Task Scheduler Queue Task called when SychronizationContext disposed#3451
iancooper merged 4 commits into
masterfrom
sync_await_false_fix

Conversation

@iancooper

Copy link
Copy Markdown
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 .NET Pull requests that update .net code labels Dec 31, 2024

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

Copy link
Copy Markdown

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
@iancooper iancooper deleted the sync_await_false_fix branch December 31, 2024 18:34

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

Copy link
Copy Markdown

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant