0
votes

I have a UWP app that works online and offline, it works fine in the debug mode and release mode. But when i compile using .Net Native Tool Chain, i usually have two major exceptions.

  1. Exception thrown: 'System.Reflection.MissingMetadataException' in System.Private.Reflection.Core.dll in MobileServiceClient Additional information: 'Microsoft.WindowsAzure.MobileServices.PlatformInformation' is missing metadata. For more information, please visit http://go.microsoft.com/fwlink/?LinkID=392859 If there is a handler for this exception, the program may be safely continued.

    Exception 1

    1: https://i.stack.imgur.com/qr7sh.jpg

    1. exception Exception thrown: 'System.TypeInitializationException' in System.Private.CoreLib.dll Additional information: A type initializer threw an exception. To determine which type, inspect the InnerException's StackTrace property.enter image description here

I have searched online how to solve this problem, no suceess yet, this has stopped me from uploading my app to store. Please help a newbie to UWP.

1

1 Answers

1
votes

The .NET Native goes through the assembly and strips out everything unused, which may be a problem when you use reflection somewhere in your code and the compiler is unable to find it. To fix this, you first have to pin-point where the reflection is used and then update the app's rd.xml file to instruct the .NET Native toolchain what needs to stay in the resulting assembly.

The first exception is giving you a link for an on-line rd.xml "generator". You just need to fill out the form and it will generate the requried XML definitions for you.

The second exception may be the source of your problems. As the message says, open the InnerException property and investigate the message. That should tell you what couldn't be initialized and what should be then added to rd.xml