Skip to content

Browser: install dispatcher sync context in JS export callbacks - #22293

Merged
MrJul merged 3 commits into
mainfrom
feature/wasm-jsexport-sync-context
Sep 24, 2026
Merged

MrJul merged 3 commits into
mainfrom
feature/wasm-jsexport-sync-context

Conversation

@kekekeks

Copy link
Copy Markdown
Member

Addresses the same symptom as #21462 but more broadly.

The runtime seems to be resetting SynchronizationContext.Current to null for [JsExport] callbacks.

PR introduces a helper that restores our sync context. Callbacks for rAF and dispatcher's own machinery are left as-is.

The runtime resets SynchronizationContext.Current on the main thread after each thread pool work item, so callbacks entered from JS saw a null context. Input, DOM and canvas exports now enter through JsCallbackHelper; animation frame and dispatcher timer callbacks are intentionally left out.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@kekekeks
kekekeks requested a review from maxkatz6 September 24, 2026 07:20
@maxkatz6 maxkatz6 added bug os-browser backport-candidate-12.1.x Consider this PR for backporting to 12.1 branch labels Sep 24, 2026
@maxkatz6
maxkatz6 enabled auto-merge September 24, 2026 07:36
@github-actions

Copy link
Copy Markdown

NuGet packages

The packages for this pull request have been published (workflow run):

@maxkatz6
maxkatz6 added this pull request to the merge queue Sep 24, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Sep 24, 2026
@MrJul
MrJul added this pull request to the merge queue Sep 24, 2026
Merged via the queue into main with commit d412d70 Sep 24, 2026
11 checks passed
@MrJul
MrJul deleted the feature/wasm-jsexport-sync-context branch September 24, 2026 12:38
grokys pushed a commit to Evan260/Avalonia that referenced this pull request Oct 7, 2026
…oniaUI#22293)

The runtime resets SynchronizationContext.Current on the main thread after each thread pool work item, so callbacks entered from JS saw a null context. Input, DOM and canvas exports now enter through JsCallbackHelper; animation frame and dispatcher timer callbacks are intentionally left out.

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
Co-authored-by: Max Katz <maxkatz6@outlook.com>
MrJul pushed a commit that referenced this pull request Oct 9, 2026
The runtime resets SynchronizationContext.Current on the main thread after each thread pool work item, so callbacks entered from JS saw a null context. Input, DOM and canvas exports now enter through JsCallbackHelper; animation frame and dispatcher timer callbacks are intentionally left out.

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
Co-authored-by: Max Katz <maxkatz6@outlook.com>
@MrJul MrJul added backported-12.1.x and removed backport-candidate-12.1.x Consider this PR for backporting to 12.1 branch labels Oct 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants