Repository navigation
Description
Current behavior 🐛
The runtime test Given_Theme_Materialization.When_Frame_Navigates_After_Theme_Switch_New_Page_Inherits_Theme crashes the test host with a fatal 0xC0000005 access violation when run against native WinUI (Windows App SDK). The crash originates inside Frame.Navigate, so it takes down the whole runtime-test run rather than failing a single assertion.
The test exercises a NavigationView hosting a Frame, navigates a ThemeProbePage in, switches the root ElementTheme to Dark, then navigates a second page in. The second frame.Navigate(...) (with a SlideNavigationTransitionInfo) is where the process faults.
0xC0000005
at ABI.Microsoft.UI.Xaml.Controls.IFrameMethods.Navigate(WinRT.IObjectReference, System.Type, System.Object, Microsoft.UI.Xaml.Media.Animation.NavigationTransitionInfo)
at Uno.UI.RuntimeTests.Tests.Windows_UI_Xaml.Given_Theme_Materialization+<When_Frame_Navigates_After_Theme_Switch_New_Page_Inherits_Theme>d__15.MoveNext()
...
at Uno.UI.RuntimeTests.Helpers.UITestHelper+<Load>d__0`1[...].MoveNext()
at Uno.UI.RuntimeTests.Helpers.UITestHelper+<WaitForLoaded>d__1`1[...].MoveNext()
at Private.Infrastructure.TestServices+WindowHelper+<WaitForIdle>d__34.MoveNext()
...
at ABI.Microsoft.UI.Xaml.IApplicationStaticsMethods.Start(WinRT.IObjectReference, Microsoft.UI.Xaml.ApplicationInitializationCallback)
at SamplesApp.Program.Main(System.String[])
Expected behavior 🎯
Frame.Navigate should not cause an access violation. The test should run to completion on native WinUI (whether it passes or fails an assertion), matching the behavior on Skia targets where it runs fine.
How to reproduce it (as minimally and precisely as possible) 🔬
- Run the runtime tests against the native WinUI SamplesApp on Windows (
/winui-runtime-tests). - Execute
Uno.UI.RuntimeTests.Tests.Windows_UI_Xaml.Given_Theme_Materialization.When_Frame_Navigates_After_Theme_Switch_New_Page_Inherits_Theme. - The host process faults with
0xC0000005during the secondFrame.Navigate.
The test source lives at src/Uno.UI.RuntimeTests/Tests/Windows_UI_Xaml/Given_Theme_Materialization.cs (the T6c scenario).
Workaround 🛠️
The test is excluded on NativeWinUI via PlatformCondition so it no longer crashes the run:
[PlatformCondition(ConditionMode.Exclude, RuntimeTestPlatforms.NativeAndroid | RuntimeTestPlatforms.NativeIOS | RuntimeTestPlatforms.NativeWinUI)]Renderer 🎨
- Native
Affected platforms 📱💻🖥️
- Windows App SDK
Anything else we need to know? 💬
- This is a native-WinUI test-harness investigation, not a user-facing regression — the fault happens inside the real WinUI
Frame.Navigate, so it may be a test-setup issue (interaction with the runtime-test host /UITestHelperlifecycle) rather than a genuine WinUI bug. - A sibling scenario in the same class —
When_Cached_Page_Renavigated_After_Theme_Switch_Inherits_Theme(T6e) — is already excluded on NativeWinUI for the same family of failure. The common factor is theThemeProbePage+Frame.Navigatepattern under the theming-materialization tests. - Goal of this issue: determine why
Frame.Navigateaccess-violates on native WinUI in this harness, then re-enable the excluded theming tests onNativeWinUI.
Activity
test(theming): exclude T6d Frame-nav test on NativeWinUI
test(theming): exclude T6d Frame-nav test on NativeWinUI
MartinZikmund commentedon Aug 31, 2026
Root cause found: null
IXamlTypederef on a page type absent fromXamlTypeInfoTraced through the WinUI C++ sources. The crash is not specific to theming,
NavigationView, orSlideNavigationTransitionInfo— it is anyFrame.Navigateto aPagetype that the app'sIXamlMetadataProviderdoesn't know about:Frame_Partial.cpp:365—NavigateWithTransitionInfoImplcallsMetadataAPI::GetClassInfoByTypeName.MetadataAPI.cpp:319— the type isn't in the runtime cache, soImportClassInfoFromMetadataProviderasks the app's provider viaGetXamlType, which returns null.MetadataAPI.cpp:853— it falls through toImportUnknownClassInfo, which builds aCCustomClassInfowith an explicitnullptr, // There's no backing IXamlType.NavigationCache.cpp:141—LoadContentthen callsActivationAPI::ActivateInstance(pType, ...).ActivationAPI.cpp:40—IFC(pType->AsCustomType()->GetXamlTypeNoRef()->ActivateInstance(ppInstance));Step 5 calls through a null
IXamlType*with no guard. Null vtable dereference →0xC0000005, unrecoverable, takes the process down. WinUI should be failing gracefully here (aNavigationFailedor a thrownHRESULT), which is why this reads as a WinUI robustness bug rather than a harness misuse.Why our pages are unknown to the provider
ThemeProbePage,CachedThemeProbePageandBlankThemePageare code-onlyPagesubclasses — they build their content withXamlReader.Loadin the constructor and are never referenced from markup, so the WinAppSDK XAML compiler emits noXamlTypeInfoentry for them.Corroboration across the whole suite
I classified all 32 distinct
Frame.Navigate(typeof(…))targets inUno.UI.RuntimeTests. There are zero counterexamples:TwoButtonFirstPagewas navigated 4× in the same failing run (Given_FocusManager) without incident, as werePage_With_AppBarButton_Visibility_Bound,CheckBoxNavReproOtherPageandFlatButtonNavReproPage.NativeWinUIor platform-gated away:Given_Frame(class-wide, since "test: DisableGiven_Frameon WinUI"),FrameIntegrationTests(class-wide),Given_XBind_NavigatedTo,Given_ListViewBase(#if __APPLE_UIKIT__) — and the threeGiven_Theme_Materializationscenarios, which are the only ones that tried and are the ones that fault.Status correction
The note in the issue description saying
When_Cached_Page_Renavigated_After_Theme_Switch_Inherits_Theme(T6e) "is already excluded on NativeWinUI" had gone stale — the exclusion was removed, and the test faulted the WinAppSDK job again. It has now been restored, and all three comments record the mechanism above.Suggested resolution
Rather than keeping the three tests excluded, convert the probe pages to real
.xaml+.xaml.cspages so they land in the generatedXamlTypeInfo. That would let T6c, T6d and T6e run on native WinUI for the first time and give genuine parity coverage for the theme-on-navigation scenarios. The same treatment would likely letGiven_FrameandFrameIntegrationTestsbe re-enabled there too.test: Exclude cached-page repeater test on native WinUI