Skip to content

Frame.Navigate fatal 0xC0000005 in theming runtime test on native WinUI #23477

Open

Description

@MartinZikmund

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) 🔬

  1. Run the runtime tests against the native WinUI SamplesApp on Windows (/winui-runtime-tests).
  2. Execute Uno.UI.RuntimeTests.Tests.Windows_UI_Xaml.Given_Theme_Materialization.When_Frame_Navigates_After_Theme_Switch_New_Page_Inherits_Theme.
  3. The host process faults with 0xC0000005 during the second Frame.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 / UITestHelper lifecycle) 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 the ThemeProbePage + Frame.Navigate pattern under the theming-materialization tests.
  • Goal of this issue: determine why Frame.Navigate access-violates on native WinUI in this harness, then re-enable the excluded theming tests on NativeWinUI.

Activity

  1. added
    triage/untriaged
    on Jun 16, 2026
  2. MartinZikmund commented on Aug 31, 2026

    @MartinZikmund
    MemberAuthor

    Root cause found: null IXamlType deref on a page type absent from XamlTypeInfo

    Traced through the WinUI C++ sources. The crash is not specific to theming, NavigationView, or SlideNavigationTransitionInfo — it is any Frame.Navigate to a Page type that the app's IXamlMetadataProvider doesn't know about:

    1. Frame_Partial.cpp:365 — NavigateWithTransitionInfoImpl calls MetadataAPI::GetClassInfoByTypeName.
    2. MetadataAPI.cpp:319 — the type isn't in the runtime cache, so ImportClassInfoFromMetadataProvider asks the app's provider via GetXamlType, which returns null.
    3. MetadataAPI.cpp:853 — it falls through to ImportUnknownClassInfo, which builds a CCustomClassInfo with an explicit nullptr, // There's no backing IXamlType.
    4. NavigationCache.cpp:141 — LoadContent then calls ActivationAPI::ActivateInstance(pType, ...).
    5. 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 (a NavigationFailed or a thrown HRESULT), which is why this reads as a WinUI robustness bug rather than a harness misuse.

    Why our pages are unknown to the provider

    ThemeProbePage, CachedThemeProbePage and BlankThemePage are code-only Page subclasses — they build their content with XamlReader.Load in the constructor and are never referenced from markup, so the WinAppSDK XAML compiler emits no XamlTypeInfo entry for them.

    Corroboration across the whole suite

    I classified all 32 distinct Frame.Navigate(typeof(…)) targets in Uno.UI.RuntimeTests. There are zero counterexamples:

    • XAML-declared targets navigate fine on native WinUI. TwoButtonFirstPage was navigated 4× in the same failing run (Given_FocusManager) without incident, as were Page_With_AppBarButton_Visibility_Bound, CheckBoxNavReproOtherPage and FlatButtonNavReproPage.
    • Every code-only target is either excluded on NativeWinUI or platform-gated away: Given_Frame (class-wide, since "test: Disable Given_Frame on WinUI"), FrameIntegrationTests (class-wide), Given_XBind_NavigatedTo, Given_ListViewBase (#if __APPLE_UIKIT__) — and the three Given_Theme_Materialization scenarios, 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.cs pages so they land in the generated XamlTypeInfo. 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 let Given_Frame and FrameIntegrationTests be re-enabled there too.

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