question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

MissingMetadataException with .NET Native on 19041

See original GitHub issue

Describe the bug

I’ve recently updated to Windows 10 19041.264, and apparently many .NET Native builds are just flat out broken for me. This includes both the Windows Community Toolkit Sample app (straight from master, cc. @michael-hawker) as well as my own app Legere (cc. @LanceMcCarthy, since you helped me pinpoint the previous issue in #1286). Some info I managed to gather:

  • The .NET Native runs fine, but the app crashes at startup.
  • I can’t repro this with a blank UWP app
  • I can repro this both in the Windows Community Toolkit Sample App and in my own app, but the crashes happen with two different types. Specifically, Windows.Foundation.IReference<double> in the sample app, and SCG.IList<WCT.Uwp.UI.Media.Effects.IPipelineEffect> in my app.
  • My app has this crash when I build it with .NET Native on my PC, but if i create a Store package without .NET Native and let the Store build it with .NET Native remotely, then the app package I install from the Store works just fine. I suspect this might be because the Store is using some VMs that have a previous Windows 10 build than 19041? 🤷‍♂️

Important question

Related to this last point, assuming this is the case, I fear that if the W10 VM the Store uses to build the apps with .NET Native gets updated to one with W10 19041, the Store could just recompile the app again (it does so occasionally) and just push that update to all my users, which would then completely trash my app, since on my device it just crashes at startup with the .NET Native build done on W10 19041. Is this fear justified? Is there anything I can do regarding this?

cc. @MichalStrehovsky and @MattWhilden as the two .NET Native experts here 😄

Steps to reproduce the bug

Steps to reproduce the behavior:

  1. Clone the Windows Community Toolkit repo (here), switch to master (ae4000bcc6cd8eb235b9915a811bd5ea1097169a at the moment).
  2. Run the Sample App in Debug x64, observe it works just fine
  3. Right click on the Sample App project > Build > tick “.NET Native toolchain”
  4. Rebuild and run
  5. Observe the crash with that metadata exception (and others as well if you click continue)

Expected behavior

The app should work just fine.

Screenshots

image

Version Info

NuGet package version:

Microsoft.UI.Xaml 2.4.2

Windows 10 version Saw the problem?
Insider Build (19041.264) Yes
November 2019 Update (18363)
May 2019 Update (18362)
October 2018 Update (17763)
April 2018 Update (17134)
Fall Creators Update (16299)
Creators Update (15063)
Device form factor Saw the problem?
Desktop Yes
Mobile
Xbox
Surface Hub
IoT

Additional context

Just as a test, I tried to checkout my app to a commit from 4+ months ago. I got the same exact crash in the same exact spot, just with a different type (I wasn’t using the .Media package from the toolkit at that time since it didn’t exist yet). When I was on 18363, I could build and run the app just fine with .NET Native, except for that other issue mentioned already in #1286.

Note that the current version of my app targets the 19041 SDK, while the version from 4+ months ago targets the 18362 SDK. Both crash with the same exact error, as mentioned above.

@LanceMcCarthy since you’re already familiar with my repo (Legere) as you helped me debug that issue the other time, if you’re on 19041 too would you mind if I gave you access to it again to try to see if you can repro the same crash on your end as well? Just to double check and hopefully gather some more info.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:7
  • Comments:32 (15 by maintainers)

github_iconTop GitHub Comments

3reactions
MattWhildencommented, Jun 1, 2020

@Sergio0694 ILCRepros are still quite helpful for app crashes. Being able to rebuild the package and run it lets us help test theories and fixes for runtime issues. 😊

2reactions
LanceMcCarthycommented, Jun 10, 2020

@Sergio0694 Thanks, I’ve cloned it and am working on preparing the repro now. I’ll open an issue in the repo for any private-project related stuff.

To comment on to your statement about how it work with a Debug .NET Native build, that’s still fundamentally different than a Release build. Do a release build and side-load/appinstaller load, I think the same crash should occur.

Read more comments on GitHub >

github_iconTop Results From Across the Web

MissingMetadataException Class (.NET Native)
Initializes a new instance of the MissingMetadataException class with a specified error message. This constructor is for internal use by the .
Read more >
MissingMetadataException when building UWP app with . ...
I tried to build the app in the Release mode using .Net native tool chain, the build completes successfully (after a good long...
Read more >
MissingMetadataException: Can't seem to figure out where ...
Hi, I'm trying to run my app in release mode, and I get the following output when the program crashes: Exception thrown: 'System.Reflection....
Read more >
Microsoft.NET.Native.Framework.2.2 installed as a ...
It's a "framework package" that is a shared dependency for all applications written with .NET Native toolchain (basically any UWP app in C#)....
Read more >
MissingMetadataException troubleshooter
NET Native does not presently have a just-in-time compiler to compile the pieces that are missing, everything that can be accessed at runtime...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found