Skip to content

test: Verify SynchronizationContext is set when binding evaluates on a newly-selected TabView tab#23024

Open
MartinZikmund wants to merge 1 commit intomasterfrom
dev/mazi/repro/12265
Open

test: Verify SynchronizationContext is set when binding evaluates on a newly-selected TabView tab#23024
MartinZikmund wants to merge 1 commit intomasterfrom
dev/mazi/repro/12265

Conversation

@MartinZikmund
Copy link
Copy Markdown
Member

Closes #12265

Summary

Issue #12265 reports that on WASM, switching to a TabView tab that hasn't been rendered before causes binding evaluations on that tab's view-model to see SynchronizationContext.Current == null, breaking user code that relies on TaskScheduler.FromCurrentSynchronizationContext().

The test exposes the scenario: a TabView with two tabs each bound to a view-model whose Numbers getter captures SynchronizationContext.Current. After selecting the second tab, the test asserts that SyncContextAtBinding is non-null for both tabs.

The test passes on current master (Skia target).

Test(s) added

  • src/Uno.UI.RuntimeTests/Tests/Microsoft_UI_Xaml_Controls/Given_TabView.SyncContext_12265.csGiven_TabView_SyncContext_12265.When_Second_Tab_Selected_Binding_Has_SynchronizationContext_12265

Notes

The issue was reported on WebAssembly (Uno 4.7.37). Runtime tests run on Skia only — the WASM-specific SynchronizationContext propagation should be verified separately on WASM.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a new Uno runtime test covering issue #12265, validating that SynchronizationContext.Current is non-null during binding evaluation when switching to a newly-selected TabView tab (intended to prevent regressions around dispatcher context propagation during tab materialization).

Changes:

  • Add a new TabView runtime test that captures SynchronizationContext.Current inside a bound property getter.
  • Assert bindings are evaluated with a non-null SynchronizationContext for both the initially rendered tab and a newly selected tab.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@unodevops
Copy link
Copy Markdown
Contributor

🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-23024/wasm-skia-net9/index.html

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.

Uno.UI.Dispatching.CoreDispatcherSynchronizationContext unexpectedly null when using databinding in Microsoft.Xaml.UI.Controls.TabView

3 participants