Click of Button with Flyout crashes when built with NativeToolchain AND app project references an unused library project that contains a XAML page

BuildCalc 6 Reputation points
2021-11-13T01:25:19.727+00:00

Describe the bug

If you have a UWP application with the following conditions:

  • Contains a Button with a MenuFlyout as its Flyout
  • Compiled with Native Toolchain
  • References another project that contains a XAMLPage

... the app will crash when the Button is pressed.
image

Some notes:

  • Many attempts have made to address this via editing the app's Default.rd.xml file. If there is something that could be added that actually address this crash, I would be very grateful as, for the project I am working on, there is no workaround for the consequences of this bug.
  • The app won't crash if the project with the XAMLPage is not referenced
  • The app won't crash if the Page class is all code (no XAML)

### Steps to reproduce the bug

TO REPLICATE

  1. Get demo project: https://github.com/baskren/UWP_UnusedXamlPageInUnusedLibraryCrash
  2. Do either a Release build or a Debug build with Native Toolchain enabled
  3. Click on the Button labeled XAML ### Expected behavior

Use of Libraries with XAML Page elements should not cause a Button with a MenuFlyout to crash.

As an aside (and me just venting), what makes this particularly egregious is:

  1. The bug happens even when the library isn't actually used in the application (and thus should have been removed by the NativeToolchain linking).
  2. Because of this bug, for my application there there just isn't a work around for this issue.

Screenshots

No response

NuGet package version

No response

Packaging type

No response

Windows version

May 2019 Update (18362)

IDE

Visual Studio 2019

Additional context

No response

Not Monitored
Not Monitored
Tag not monitored by Microsoft.
36,524 questions
{count} vote

2 answers

Sort by: Most helpful
  1. BuildCalc 6 Reputation points
    2021-11-19T12:58:38.9+00:00

    @Nico Zhu (Shanghai Wicresoft Co,.Ltd.)

    Because you cannot replicate this, I ask two things:

    1. Can you share your solution (via github, for example)? Perhaps there is an important difference in your project that would make a big difference for me. Again, I'm asking for help (if I'm at fault) or attention to this bug.
    2. I have created two short videos demonstrating how to create a project that fails - using ONLY VisualStudio 2019 - NOT dotnet new unoapp. I do this because I want to make it clear that this issue has NOTHING to do with unoapp. I had to create two videos because I was using xbox game bar for the recordings and it wouldn't continuously record.

    The first video (https://1drv.ms/v/s!AkPAsLOJX3DCwS0kE8TYTwk-XIWb?e=l8OpGx) shows how the UWP Application project was created (using Create a New Project / Blank App (Universal Windows)). The second video (https://1drv.ms/v/s!AkPAsLOJX3DCwS5V1X9WVjdMjLZb?e=MpTykB) shows the following:

    • Adding the Button with the Flyout
    • Successfully running the newly created UWP app (again, because I was using xbox game bar, you can only see VisualStudio, not the running app)
    • Adding a new UWP Class Library, adding a new blank XAML Page to that library, and referencing that library in the UWP app project
    • Successfully running the UWP app again
    • Change the UWP App Build Settings to enable Native Toolchain
    • Unsuccessfully running the UWP app again

    The video should be very clear - this really appears to be a bug. I'm not doing anything beyond the most basic of operations in VisualStudio.

    Again, I ask for consideration for this issue.

    0 comments No comments

  2. BuildCalc 6 Reputation points
    2021-11-19T14:10:58.227+00:00

    @Nico Zhu (Shanghai Wicresoft Co,.Ltd.)

    Because the previous videos were recorded using xbox game bar, they're not as illustrative as I would like. As such, I've created a screen recording using PowerPoint that captures all of the actions I took and the application when running. You can find that MP4 video here: https://1drv.ms/v/s!AkPAsLOJX3DCwTKzJnfmZ2RLbff9?e=YZpZEg

    Again, you will see that there is NOTHING outside of the normal UWP App + UWP Library workflow in this video. The App + Library work until Native Toolchain is enabled.

    Again, I ask for consideration for this issue.