Bug 59538 - [UWP Windows Store] Template App crashes at startup with UWP app package created for upload
Summary: [UWP Windows Store] Template App crashes at startup with UWP app package crea...
Status: CONFIRMED
Alias: None
Product: Forms
Classification: Xamarin
Component: Windows ()
Version: 2.4.0
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2017-09-15 22:22 UTC by Jon Goldberger [MSFT]
Modified: 2017-09-17 08:25 UTC (History)
2 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:


Attachments
Test Project (874.34 KB, application/zip)
2017-09-15 22:22 UTC, Jon Goldberger [MSFT]
Details


Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report for Bug 59538 on Developer Community or GitHub if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: Developer Community HTML or GitHub Markdown
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:
Status:
CONFIRMED

Description Jon Goldberger [MSFT] 2017-09-15 22:22:29 UTC
Created attachment 24786 [details]
Test Project

## Description

When a Template Forms UWP app that works fine in Debug and Release is installed from an appxupload bundle the app crashes at startup with the following in the crash report (viewed with Event Viewer):

>Faulting application name: TestTemplateFormsForUWPStoreBug.UWP.exe, version: 1.0.2.0, time stamp: 0x59ad840d
>Faulting module name: Windows.UI.Xaml.dll, version: 10.0.15063.608, time stamp: 0xcadddd38
>Exception code: 0xc000027b

I can reproduce this with a template Xamarin.Forms solution (attached).

## Steps to reproduce

1. Open the attached solution

2. Select the UWP app project in the solution explorer

3. Create a package for upload to the Windows Store with:
> Project -> Store -> Create App Packages -> Yes (as TestTemplateForms...)

4. When build finishes, you should end up with an App Packages folder. In that folder you should have another folder ending in _Test and a .appxupload file. 

5. Change the .appxupload extension to .zip and unzip that file.

6. Open the newly unzipped folder and double click on the .appxbundle file to install the app to your system

Expected result: App will launch and display the well know "Welcome to Xamarin Forms!" message.

Actual result: App crashes with error noted above in crash report for app seen in Event Viewer. 


## Notes

If you instead install the .appxbundle that is in the folder ending in _Test, that will launch and display the welcome message as expected, it is just the bundle that is in the appxupload file that crashes, and this is what gets uploaded to the store. 

## regression status

Not a recent regression.

BAD: 2.3.4
BAD: 2.4.0

## Environment

Microsoft Visual Studio Enterprise 2017 
Version 15.3.4
VisualStudio.15.Release/15.3.4+26730.15
Microsoft .NET Framework
Version 4.7.02046

Installed Version: Enterprise

Architecture Diagrams and Analysis Tools   00369-90253-02232-AA699
Microsoft Architecture Diagrams and Analysis Tools

Visual Basic 2017   00369-90253-02232-AA699
Microsoft Visual Basic 2017

Visual C# 2017   00369-90253-02232-AA699
Microsoft Visual C# 2017

Visual C++ 2017   00369-90253-02232-AA699
Microsoft Visual C++ 2017

Visual F# 4.1   00369-90253-02232-AA699
Microsoft Visual F# 4.1

Application Insights Tools for Visual Studio Package   8.8.00712.1
Application Insights Tools for Visual Studio

ASP.NET and Web Tools 2017   15.0.30726.0
ASP.NET and Web Tools 2017

ASP.NET Core Razor Language Services   1.0
Provides languages services for ASP.NET Core Razor.

ASP.NET Template Engine 2017   15.0.30726.0
ASP.NET Template Engine 2017

ASP.NET Web Frameworks and Tools 2012   4.0.20601.0
For additional information, visit https://www.asp.net/

ASP.NET Web Frameworks and Tools 2017   5.2.50601.0
For additional information, visit https://www.asp.net/

Azure App Service Tools v3.0.0   15.0.30728.0
Azure App Service Tools v3.0.0

Azure Data Lake Node   1.0
This package contains the Data Lake integration nodes for Server Explorer.

Azure Data Lake Tools for Visual Studio   2.2.9000.1
Microsoft Azure Data Lake Tools for Visual Studio

Azure Data Lake Tools for Visual Studio   2.2.9000.1
Microsoft Azure Data Lake Tools for Visual Studio

Common Azure Tools   1.10
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.

Fabric.DiagnosticEvents   1.0
Fabric Diagnostic Events

JavaScript Language Service   2.0
JavaScript Language Service

JavaScript Project System   2.0
JavaScript Project System

JavaScript UWP Project System   2.0
JavaScript UWP Project System

Merq   1.1.17-rc (cba4571)
Command Bus, Event Stream and Async Manager for Visual Studio extensions.

Microsoft Azure HDInsight Azure Node   2.2.9000.1
HDInsight Node under Azure Node

Microsoft Azure Hive Query Language Service   2.2.9000.1
Language service for Hive query

Microsoft Azure Service Fabric Tools for Visual Studio   1.7
Microsoft Azure Service Fabric Tools for Visual Studio

Microsoft Azure Stream Analytics Language Service   2.2.9000.1
Language service for Azure Stream Analytics

Microsoft Azure Stream Analytics Node   1.0
Azure Stream Analytics Node under Azure Node

Microsoft Azure Tools   2.9
Microsoft Azure Tools for Microsoft Visual Studio 2017 - v2.9.50719.1

Microsoft Continuous Delivery Tools for Visual Studio   0.3
Simplifying the configuration of continuous build integration and continuous build delivery from within the Visual Studio IDE.

Microsoft JVM Debugger   1.0
Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines

Microsoft MI-Based Debugger   1.0
Provides support for connecting Visual Studio to MI compatible debuggers

Microsoft Visual C++ Wizards   1.0
Microsoft Visual C++ Wizards

Microsoft Visual Studio VC Package   1.0
Microsoft Visual Studio VC Package

Mono Debugging for Visual Studio   4.6.8-pre (ec7034f)
Support for debugging Mono processes with Visual Studio.

NuGet Package Manager   4.3.1
NuGet Package Manager in Visual Studio. For more information about NuGet, visit http://docs.nuget.org/.

SQL Server Data Tools   15.1.61707.200
Microsoft SQL Server Data Tools

ToolWindowHostedEditor   1.0
Hosting json editor into a tool window

TypeScript   2.3.4.0
TypeScript tools for Visual Studio

Visual C++ for Cross Platform Mobile Development (Android)   15.0.26724.01
Visual C++ for Cross Platform Mobile Development (Android)

Visual C++ for Cross Platform Mobile Development (iOS)   15.0.26724.01
Visual C++ for Cross Platform Mobile Development (iOS)

Visual Studio Code Debug Adapter Host Package   1.0
Interop layer for hosting Visual Studio Code debug adapters in Visual Studio

Visual Studio Tools for Universal Windows Apps   15.0.26730.08
The Visual Studio Tools for Universal Windows apps allow you to build a single universal app experience that can reach every device running Windows 10: phone, tablet, PC, and more. It includes the Microsoft Windows 10 Software Development Kit.

WebJobs Tools v1.0.0   15.0.30901.0
WebJobs Tools v1.0.0

Xamarin   4.6.3.4 (0841c2aaf)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin.Android SDK   7.4.3.1 (18558b4)
Xamarin.Android Reference Assemblies and MSBuild support.

Xamarin.iOS and Xamarin.Mac SDK   10.12.3.3 (8a39106)
Xamarin.iOS and Xamarin.Mac Reference Assemblies and MSBuild support.
Comment 2 Jon Goldberger [MSFT] 2017-09-15 22:36:04 UTC
Also worth noting:

The issue does not occur if you remove the Forms code from the UWP project. IOW take out the Xamarin.Forms.Init() call and the LoadApplication call, and change the UWP MainPage back to inheriting from a UWP Page and then add A UWP Control to the MainPage xaml, this issue does not occur. The app will launch and work when sideloaded from the appxupload bundle. So it would seem to be something in forms that is the proximate cause of this issue.
Comment 3 jmalbarran 2017-09-17 08:25:30 UTC
Hi

(We are the customer with the original problem)

Please, notice:

1) Similar incident has been reported in the forum in Apr 2016. We have detected this incident initially in Forms 2.3.3
2) In our non-expert opinion, the incident is related with late availability of forms runtime in memory
3) But, it seems a well known incident from 2.2 (see https://developer.xamarin.com/guides/xamarin-forms/platform-features/windows/installation/universal/#Troubleshooting)
4) The workaround proposed in the guide (change init to include initial assemblies), or internet (use only x86 version) doesn't work 


And, for getting us totally crazy, it seems that we have generated and appxupload package that crashes side-installed locally (from the xxxx.appxupload file), but runs well if we install from market. We are reconfirming this strange behavior, but don't have enough information about what the market does on the appxupload package. Notice: This happened only once.