Skip to content

.NET: Prevent async tool deadlocks on caller contexts - #299

Open
jsturtevant wants to merge 2 commits into
mainfrom
jsturtevant-dotnet-async-context
Open

jsturtevant wants to merge 2 commits into
mainfrom
jsturtevant-dotnet-async-context

Conversation

@jsturtevant

@jsturtevant jsturtevant commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Prevent async tools from deadlocking synchronous Run when the caller has a single-threaded synchronization context. The wrappers keep handler entry on the callback thread and restore the caller context after completion or failure.

The regression-only commit failed in CI with four deadlocks; the fix passes all 156 .NET tests locally.

Fixes #298.

Signed-off-by: James Sturtevant <jsturtevant@gmail.com>
Signed-off-by: James Sturtevant <jsturtevant@gmail.com>
@jsturtevant
jsturtevant marked this pull request as ready for review November 13, 2026 00:22

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

.NET: Prevent async tool deadlocks with a SynchronizationContext

1 participant