Xamarin.forms: [UWP] Store build for template app crashes when installed locally

Created on 20 Jul 2018  ·  3Comments  ·  Source: xamarin/Xamarin.Forms

Description

The Visual Studio Xamarin Forms UWP template project built for store crashes on startup when installed from the .appxupload package.

Steps to Reproduce

  1. Create a new Xamarin-Froms Project in Visual Studio 15.7.1
  2. Trigger a store build (with native compilation) for the UWP project (Store -> Package for store)
  3. Use the .appxupload package to install the App locally
  4. The app crashes on startup

Expected Behavior

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.

Actual Behavior

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.

Basic Information

  • Version with issue: 2.5., 3.
  • Last known good version: -
  • IDE: VS 15.7.1
  • Platform Target Frameworks: UWP (14393, 15063 ...)
  • Affected Devices: Windows 10 x86/x64

Reproduction Link

Not needed as this happens with the template project bundled with Visual Studio.

Additional info

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.

5 high impact UWP bug

Most helpful comment

/cc @krumelur

All 3 comments

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

Was this page helpful?
0 / 5 - 0 ratings