question

buildcalc avatar image
0 Votes"
buildcalc asked NicoZhu-MSFT edited

[uwp] Frame.Navigate( typeof(non_xaml_class_derived_from_Page)) crashes w/ Native Toolchain

Describe the bug

When given a Non-XAML (pure code) class derived from Page, Frame.Navigate crashes when compiled using Native Toolchain.

Steps to reproduce the bug


USING SAMPLE PROJECT


  1. Clone the following repo: https://github.com/baskren/NativeToolchain_NonXamlPage_crash.git

  2. Run in Debug WITHOUT Native Toolchain

  3. Click NOT A XAML PAGE button to navigate from XAML PAGE to NOT A XAML PAGE, successfully

  4. Run in Debug WITH Native Toolchain or run in Release

  5. Click NOT A XAML PAGE button to crash app.

FROM SCRATCH

  1. Create a new UWP App

  2. Create a new class file, named NoXaml.cs and derive the class NoXaml from Windows.UI.Xaml.Controls.Page

  3. Add [Windows.UI.Xaml.Data.Bindable] attribute to the NoXaml class

  4. In App.xaml.cs, replace rootFrame.Navigate(typeof(MainPage), e.Arguments); with rootFrame.Navigate(typeof(NoXaml), e.Arguments);

  5. In the project's options, enable the Native Toolchain

  6. Build, run, watch crash

Expected behavior

Frame.Navigate works with Non-XAML Pages.

Screenshots

image


IDE

Visual Studio 2019

NuGet package version

No response

Project type

  • [X] Packaged

  • [X] Unpackaged

Windows version

May 2021 Update (19043)

Additional context

Note: recommendation from https://github.com/microsoft/microsoft-ui-xaml/issues/1949 was applied

windows-uwp
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

NicoZhu-MSFT avatar image
0 Votes"
NicoZhu-MSFT answered NicoZhu-MSFT edited

Hello,
Welcome to Microsoft Q&A!

Frame.Navigate( typeof(non_xaml_class_derived_from_Page)) crashes w/ Native Toolchain

Describe the bug

First of all we can reproduce your problem. and I found you have post issue report in WinUI github. It was added needs-triage tag. So please pay attention to the following up where in the WinUI github. And I will keep follow up this problem. If I have any updates , I will also update below.

Thank you.

If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.