Repository navigation
Description
TL;DR: Given_Control.When_Template_Changed_After_Loaded, added by #26556 on 24 Nov, fails on the real WinUI (WinAppSDK) lane in every master build since it merged. In the PR's own CI it needed a retry to pass, so it was flaky from the start. The Uno change it covers doesn't run on that lane, so the test's expectation, not the fix, is what fails.
Current behavior 🐛
The "Tests - WinAppSDK" stage runs the Uno runtime tests against real WinUI. It passed in every master build from 18 Nov to 24 Nov 11:11 UTC. #26556 ("fix(control): Re-measure when Template changes") merged at 09:28 UTC on 24 Nov. Since then the stage has failed in each master build that includes it:
248697, 248715, 248718, 248723, 248840, 248841, 248850, 248862 and 248868. That is 9 builds on the same failure; the first, 248697, finished at 13:58 UTC on 24 Nov.
The assertion each time:
Assert.IsNotNull failed. 'value' expression: 'SUT.FindFirstDescendant<Border>("SecondTemplateRoot")'. The new template was not applied
at Uno.UI.RuntimeTests.Tests.Windows_UI_Xaml.Given_Control.When_Template_Changed_After_Loaded()
It retries twice (the test runner's "Retry 1/2" and "Retry 2/2") and fails each time, so the stage goes red.
It was flaky in the PR too. The PR's CI (247851, 20 Nov) passed the WinAppSDK stage, but the log shows the same assertion failing once ("Retry 1/2") before the test passed. So it passed only on the retry.
Expected behavior
A runtime test that runs on WinUI should pass the same way every run. On WinUI, the test should either wait until the new template is applied, or not run there.
How to reproduce it
Run Given_Control.When_Template_Changed_After_Loaded on the WinAppSDK head. It failed on every attempt in master builds on 24 Nov and needed a retry in the PR build.
Anything else we need to know?
- A guess at the cause, not confirmed. The test (
src/Uno.UI.RuntimeTests/Microsoft/UI/Xaml/Given_Control.cs) setsTemplate = null, waits for idle, sets a second template, waits for idle once, then asserts the second template's root exists. On real WinUI the new template may not be applied by that point, and the retry delay is 2 ms, so retries don't help. Waiting for the root to appear (aWaitForon the condition) instead of a single idle wait may be enough. I haven't run it on WinUI. - The Uno fix isn't what fails. The change in
Control.cs(AffectsMeasureonTemplateProperty) only affects Uno's own control stack. The WinAppSDK lane uses WinUI'sControl, so that lane only exercises the test's expectation. - Options: make the wait robust, or exclude the test on WinUI if its behaviour there differs. Either is a test-only change.
- A separate failure, one build so far. In 248895 the WinAppSDK test app crashed with an access violation (exit code -1073741819) while running
When_Sheet_Collapses_Focus_Leaves_Its_Content, so no results file was written. I haven't looked into it. - Cost. Master has failed this stage in every build since the merge, so it is red for this reason alone from the WinAppSDK side, and every rerun repeats it.
What I haven't done. I haven't run the test on WinUI or tried a fix.
Related: #26556.
Activity