Skip to content

Runtime tests treat native WinUI as lacking enhanced lifecycle #24201

Open

Description

@MartinZikmund

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:

  1. Per-site, matching the idiom already present in these files — #if !UNO_HAS_ENHANCED_LIFECYCLE && !WINAPPSDK for the [Ignore] sites and #if UNO_HAS_ENHANCED_LIFECYCLE || WINAPPSDK for the assertion sites.
  2. Project-level — define UNO_HAS_ENHANCED_LIFECYCLE alongside WINAPPSDK in Uno.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. The SamplesApp.Windows head 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:

  1. grep -rn "UNO_HAS_ENHANCED_LIFECYCLE" src/Uno.UI.RuntimeTests/ lists all fifteen sites.
  2. src/Uno.CrossTargetting.targets (lines 66 and 70) shows the symbol is defined only for __WASM__ and __SKIA__.
  3. src/Uno.UI.RuntimeTests/Uno.UI.RuntimeTests.Windows.csproj:73 defines WINAPPSDK and not UNO_HAS_ENHANCED_LIFECYCLE.
  4. 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

  1. added
    triage/untriaged
    on Aug 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    triage/untriaged

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions