The Visual Studio Xamarin Forms UWP template project built for store crashes on startup when installed from the .appxupload package.
The Xamarin Forms .appxupload file should not crash on startup and be testable. This blocks Microsoft Store form testing apps before being published (in case it's required) and blocks developers to get their apps which need testing from getting published.
As soon as the Xamarin.Forms.Init() is removed from the UWP project (effectively removing xf) the UWP does not crash anymore when built for store. Happens for both x86 or x64 builds. Building only x86 does not change anything.
It's worth mentioning that the _Test appxbundle works perfectly it's only the store appxupload which has the problems.
Not needed as this happens with the template project bundled with Visual Studio.
https://bugzilla.xamarin.com/show_bug.cgi?id=59538
https://developercommunity.visualstudio.com/content/problem/150965/xamarin-forms-project-uwp-app-dies-on-start-when-i.html
Some of the above posts were explaining that even though the .appxupload crashes when installed locally the when downloaded and installed from the Microsoft store the package will run without a problem. Our problem with this part is that our .appxupload package needs to be tested by Microsoft before the store publish because of the desktop bridge permission. Because it crashes when locally testing it cannot be published.
When I tested this locally the exception I saw when attached to a debugger resembled this
https://stackoverflow.com/questions/50010855/could-not-load-file-or-assembly-system-private-corelib
I don't think we're using any Desktop Extensions but we are using Mobile Extensions so possibly related?
That being said I followed the instructions here
https://docs.microsoft.com/en-us/windows/uwp/porting/desktop-to-uwp-packaging-dot-net
To create a a project via a Package Project and with that bundle I'm able to install and run locally (using .\Add-AppDevPackage.ps1) without any issues.
Additional thoughts
https://stackoverflow.com/questions/50216085/missing-system-assembly-in-appxupload-only
Microsoft before the store publish because of the desktop bridge permission
@xabre because you are using desktop bridge permissions can you try to use a UWP packaging project and submit that to the store?
https://docs.microsoft.com/en-us/windows/uwp/porting/desktop-to-uwp-packaging-dot-net
Some additional notes about why
https://stackoverflow.com/questions/50010855/could-not-load-file-or-assembly-system-private-corelib
A few additional notes from some exploratory work on this
The appxbundle that's inside appxupload isn't double click install ready. There are a number of dependencies that don't get installed alongside this file which is why it crashes when running locally. If you run the ps1 file in the _test folder you'll see that it first installs some dependencies alongside the appxbundle.
From what I found If you create a completely vanilla UWP project (without forms) and set the Min Target to >= 16299 then the appxbundle inside appxupload is not installable by itself. You can copy the appxbundle into the _test folder then run the ps1 file so it installs the dependencies along side but the file itself is not functionally installable by just double clicking it. Not being able to install that bundle doesn't seem related to the store not being able to run the application
/cc @krumelur
Most helpful comment
/cc @krumelur