Repository navigation
test: Add regression test for #2872 - #22991
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a new runtime regression test intended to cover #2872 (x:Bind evaluation timing vs. OnNavigatedTo / DataContextChanged).
Changes:
- Added a new MSTest case that navigates after an
awaitto simulate the reported scenario. - Added a dedicated XAML Page + code-behind to reproduce the
OnNavigatedTo/DataContextChangedupdate sequence. - Wired the test to run on UI thread and linked it to the GitHub work item.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
src/Uno.UI.RuntimeTests/Tests/BindingTests/Given_XBind_NavigatedTo.cs |
Introduces the regression test that performs delayed navigation and asserts expected post-navigation state. |
src/Uno.UI.RuntimeTests/Tests/BindingTests/XBind_NavigatedTo_Page.xaml |
Adds a minimal repro page with x:Bind to BoundText. |
src/Uno.UI.RuntimeTests/Tests/BindingTests/XBind_NavigatedTo_Page.xaml.cs |
Implements OnNavigatedTo + DataContextChanged behavior intended to trigger the binding timing scenario. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-22991/wasm-skia-net9/index.html |
|
This PR is stale because it has been open 60 days with no activity. Remove stale label or comment or it will be closed in 10 days. |
|
This PR was closed because it has been stalled for 10 days with no activity. |
|
Claude finished @MartinZikmund's task in 2m 8s —— View job Review complete
SummaryThe approach is sound — a Blocking (2):
Minor (3):
Validation evidence:
|
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-22991/wasm-skia-net9/index.html |
Address PR review feedback on #22991: - Fix native WinUI build: gate OnNavigatedTo's `internal` modifier behind `#if HAS_UNO`. Uno's Page.OnNavigatedTo is `protected internal virtual` while WinUI's is `protected`, so the override must drop `internal` on native WinUI. Matches the SourceTypePage pattern in Given_Frame. - Remove the Bindings.Update() workaround from DataContextChanged so the test no longer masks the original timing regression. - Assert the rendered TheTextBlock.Text (via FindName + WaitFor), not just the backing BoundText property, to catch the stale-UI case. - Use Task.Yield() instead of Task.Delay(200) for the async break. Kept `using static Private.Infrastructure.TestServices;` (reviewers suggested removing it): WindowHelper is the nested Private.Infrastructure.TestServices.WindowHelper, not a type in Uno.UI.RuntimeTests.Helpers, and isn't a global using, so removing it would break compilation. Runtime-validated: passes on Skia Desktop. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01A9s2iUVnwJRRdpviweaTCR
94d30f2 to
456b546
Compare
|
Claude finished @MartinZikmund's task in 5m 19s —— View job Review complete
SummaryThe
Correction to previous review: The prior round incorrectly flagged 3 remaining minor issues flagged inline:
The regression test shape is correct: Validation evidence:
|
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-22991/wasm-skia-net9/index.html |
- Reset WindowHelper.WindowContent in a finally block so a WaitFor timeout can't leak the Frame into the next test. - Drop the unused `using Uno.UI.RuntimeTests.Helpers;`. - Drop the redundant `using Microsoft.VisualStudio.TestTools.UnitTesting;` (already a global using in GlobalUsings.cs). Runtime-validated: passes on Skia Desktop. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01A9s2iUVnwJRRdpviweaTCR
|
Claude finished @MartinZikmund's task in 2m 25s —— View job Review complete
SummaryThe
No new issues found. The test is well-structured:
Validation evidence:
|
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-22991/wasm-skia-net9/index.html |
Summary
Adds regression test for #2872.
The reported issue appears to be potentially fixed — the test(s) pass on current master (Skia target).
Test(s) added
src/Uno.UI.RuntimeTests/Tests/BindingTests/Given_XBind_NavigatedTo.cs→When_XBind_Updated_After_DataContext_Set_In_OnNavigatedTosrc/Uno.UI.RuntimeTests/Tests/BindingTests/XBind_NavigatedTo_Page.xaml+.xaml.cs(test page)Notes
The issue was reported on iOS, Android, WebAssembly. Runtime tests run on Skia only — the fix should be verified on native targets as well.
The test verifies that
x:Bindreflects property values set duringOnNavigatedTowhen anawaitprecedes navigation. It navigates to a page that setsDataContextinOnNavigatedTo, triggeringDataContextChangedwhich updates a bound property and callsBindings.Update().Relates to #2872