Release builds on UWP are crashing at runtime at startup with a 'System.PlatformNotSupportedException' in System.Private.CoreLib.dll` exception. A repository to reproduce is here https://github.com/ueman/mvvmcross6crash
The UWP Playground should yield the same behaviour as the provided repository.
Upon further investigation this seems to be a problem with the build option Compile with .NET Native tool chain. If the option is turned off it works as expected, however you can't deploy to the Windows App Store. So this is still a problem.
Create new project with MvvmCross 6. The Core project is a .Net Standard 2 Class Library and the UWP project is a Universal Windows Project. MvvmCross is included as NuGet.
Compile release build.
Run release build.
The application should not crash.
The application crashes with a Exception thrown: 'System.PlatformNotSupportedException' in System.Private.CoreLib.dll Exception.
Version: 6.0.0 and 6.0.1
Platform:
Good find - frustrating that it works in debug but not release (thanks for the great simple example)
Workaround - use a custom setup class that overrides getpluginassembly
public class CustomSetup: MvxWindowsSetup
{
public override IEnumerable
{
return new[] { typeof(MvxPluginAttribute).Assembly };
}
}
Thanks for the response. That does indeed fix it.
After some research i think the exception comes from the code in this method https://github.com/MvvmCross/MvvmCross/blob/082ce799a17f31839b7c1221aacc4737942bc58e/MvvmCross/Core/MvxSetup.cs#L270 and has something to do with reflection.
@ueman as per my workaround, the issue is that GetPluginAssembly (which is called by InitializePluginFramework) is calling a method that isn't supported on UWP
Closing because the issue was fixed.
Most helpful comment
Good find - frustrating that it works in debug but not release (thanks for the great simple example) GetPluginAssemblies()
Workaround - use a custom setup class that overrides getpluginassembly
public class CustomSetup: MvxWindowsSetup
{
public override IEnumerable
{
return new[] { typeof(MvxPluginAttribute).Assembly };
}
}