test: Verify SynchronizationContext is set when binding evaluates on a newly-selected TabView tab#23024
Open
MartinZikmund wants to merge 1 commit intomasterfrom
Open
test: Verify SynchronizationContext is set when binding evaluates on a newly-selected TabView tab#23024MartinZikmund wants to merge 1 commit intomasterfrom
MartinZikmund wants to merge 1 commit intomasterfrom
Conversation
Contributor
There was a problem hiding this comment.
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
TabViewruntime test that capturesSynchronizationContext.Currentinside a bound property getter. - Assert bindings are evaluated with a non-null
SynchronizationContextfor both the initially rendered tab and a newly selected tab.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
src/Uno.UI.RuntimeTests/Tests/Microsoft_UI_Xaml_Controls/Given_TabView.SyncContext_12265.cs
Show resolved
Hide resolved
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 onTaskScheduler.FromCurrentSynchronizationContext().The test exposes the scenario: a
TabViewwith two tabs each bound to a view-model whoseNumbersgetter capturesSynchronizationContext.Current. After selecting the second tab, the test asserts thatSyncContextAtBindingis 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.cs→Given_TabView_SyncContext_12265.When_Second_Tab_Selected_Binding_Has_SynchronizationContext_12265Notes
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.