Repository navigation
Description
Current behavior 🐛
Six UNO_HAS_ENHANCED_LIFECYCLE conditionals in the runtime tests treat native WinUI as a target without enhanced lifecycle. It has one, so these sites put the WinAppSDK test leg on the legacy Uno path.
UNO_HAS_ENHANCED_LIFECYCLE is defined in src/Uno.CrossTargetting.targets for __WASM__ and __SKIA__ only, so it is undefined when Uno.UI.RuntimeTests.Windows.csproj compiles. Most sites compensate by pairing the symbol with WINAPPSDK or !HAS_UNO; these six do not.
Four of them suppress a test on WinUI:
| File | Line | Expression | Effect |
|---|---|---|---|
Tests/Windows_UI_Xaml_Controls/Given_Frame.cs |
56 | #if !UNO_HAS_ENHANCED_LIFECYCLE |
[Ignore("This test fails on Uno Platform targets. See #14300")] — the reason names Uno targets, but the condition also skips WinUI |
Tests/Windows_UI_Xaml/Given_FrameworkElement.cs |
1154 | #if !UNO_HAS_ENHANCED_LIFECYCLE |
[Ignore("Works only with proper lifecycle.")] |
Tests/Windows_UI_Xaml/Given_FrameworkElement_Layouting.cs |
95 | #if !UNO_HAS_ENHANCED_LIFECYCLE |
[Ignore("Properly works only with enhanced lifecycle")] |
IntegrationTests/dxaml/controls/combobox/ComboBoxIntegrationTests.cs |
1299 | #if !UNO_HAS_ENHANCED_LIFECYCLE |
[Ignore("Due to lifecycle differences, the selection gets updated before the index is reset...")] |
Two do not skip — they assert Uno's known-divergent values against real WinUI:
| File | Line | Expression | Effect |
|---|---|---|---|
MUX/Microsoft_UI_Xaml_Controls/Repeater/ViewportTests.cs |
92 | #if UNO_HAS_ENHANCED_LIFECYCLE |
WinUI takes the #else, commented "TODO: Uno specific: In our case only one Measure loop occurs", and asserts 1 realization rect instead of the upstream 2 |
Tests/Windows_UI_Xaml_Controls/Given_Flyout.cs |
942 | #if UNO_HAS_ENHANCED_LIFECYCLE |
WinUI is compared against the legacy expected-string rather than the enhanced one |
Given_FrameworkElement_Layouting.cs is the clearest evidence this is an oversight rather than a convention: the same file pairs the symbol correctly at line 54 (#if UNO_HAS_ENHANCED_LIFECYCLE || WINAPPSDK) and line 76 (#elif ...), then omits the pairing at line 95.
Expected behavior 🎯
Native WinUI should follow the enhanced-lifecycle path in every one of these conditionals, as it already does at the ten correctly-paired sites (Given_Control.cs:235, Given_ResourceDictionary.cs:73/81/129/138/148, Given_FrameworkElement.cs:1200, Given_FrameworkElement_Layouting.cs:54/76, and SamplesApp.Shared/MainPage.xaml.cs:21).
Two ways to get there:
- Per-site, matching the idiom already present in these files —
#if !UNO_HAS_ENHANCED_LIFECYCLE && !WINAPPSDKfor the[Ignore]sites and#if UNO_HAS_ENHANCED_LIFECYCLE || WINAPPSDKfor the assertion sites. - Project-level — define
UNO_HAS_ENHANCED_LIFECYCLEalongsideWINAPPSDKinUno.UI.RuntimeTests.Windows.csproj, so the symbol means "the target under test has enhanced lifecycle". This fixes all six at once and leaves the paired sites correct-but-redundant, at the cost of reinterpreting an Uno-internal flag inside a WinAppSDK compilation. TheSamplesApp.Windowshead would want the same treatment.
Either fix changes what the WinUI leg runs: four tests switch on and two assertion sets flip, so it needs a WinUI run to confirm whether each test then passes or documents a genuine WinUI difference.
How to reproduce it (as minimally and precisely as possible) 🔬
No repro app applies — this is visible by inspection of the test sources and the define set:
grep -rn "UNO_HAS_ENHANCED_LIFECYCLE" src/Uno.UI.RuntimeTests/lists all fifteen sites.src/Uno.CrossTargetting.targets(lines 66 and 70) shows the symbol is defined only for__WASM__and__SKIA__.src/Uno.UI.RuntimeTests/Uno.UI.RuntimeTests.Windows.csproj:73definesWINAPPSDKand notUNO_HAS_ENHANCED_LIFECYCLE.- Running the WinUI leg shows the four tests above reported as skipped.
Workaround 🛠️
None required — no shipping code is affected. The impact is reduced WinUI parity coverage and two tests that would assert Uno's divergence as if it were WinUI's behavior.
Renderer 🎨
Not applicable — test-project conditional compilation.
Affected platforms 📱💻🖥️
Windows App SDK
Uno.Sdk version (and other relevant versions) 📦
Not applicable — repository sources, observed on feature/breakingchanges.
IDE version 🧑💻
Not applicable.
Anything else we need to know? 💬
Surfaced while sweeping UNO_HAS_ENHANCED_LIFECYCLE for dead conditionals in src/Uno.UI (spec 058-dead-conditional-branches). The src/Uno.UI sites were genuinely dead and were removed there; these test sites are live and were deliberately left alone, because correcting them is a change to the WinUI test leg rather than dead-code removal.
Activity
docs: Correct the WinUI enhanced-lifecycle note