Bug 53336 - XamlCompilation causes runtime exception when an array resource is defined
Summary: XamlCompilation causes runtime exception when an array resource is defined
Status: RESOLVED FIXED
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 2.3.3
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Stephane Delcroix
URL:
Depends on:
Blocks:
 
Reported: 2017-03-15 03:02 UTC by Gabor Nemeth
Modified: 2017-03-27 12:27 UTC (History)
3 users (show)

Tags: xamlc, runtime crash
Is this bug a regression?: ---
Last known good build:


Attachments
repro app (306.77 KB, application/x-zip-compressed)
2017-03-15 03:02 UTC, Gabor Nemeth
Details
repro sample for XF 2.3.4.214-pre5 (328.60 KB, application/x-zip-compressed)
2017-03-17 10:20 UTC, Gabor Nemeth
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 on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

Description Gabor Nemeth 2017-03-15 03:02:47 UTC
Created attachment 20331 [details]
repro app

Compiling a XAML page or view which contains an <x:Array> as a resource causes runtime error. Even if the resource is not used anywhere. Experienced this behavior on Android and UWP. If I turn off XAML compilation on the page, the app runs fine.
Attached a simple app for reproduction.
Comment 1 Jimmy [MSFT] 2017-03-15 15:48:50 UTC
I was able to reproduce this crash with the attached repro project on Forms 2.3.3.193, however it appears to be resolved with Forms 2.3.4-pre5.

With 2.3.3.193 the app would crash on all platforms upon launching. On Android the debug output showed:

> 03-15 08:29:15.002 E/mono-rt ( 1387): [ERROR] FATAL UNHANDLED EXCEPTION: System.InvalidProgramException: Invalid IL code in XamFormsIssues.MainPage:InitializeComponent (): IL_0139: callvirt  0x0a000021

so this is possible the same or a similar issue to bug 53051.


### Resolution status
I also tested with Forms 2.3.4-pre5 and the crash no longer occurs with the newer version. If you still experience this issue with Forms 2.3.4-pre4 or later please re-open this bug and attach an updated repro project.


### Version Tests
Forms 2.3.4-pre5    GOOD
Forms 2.3.3.193     BAD
Comment 2 Gabor Nemeth 2017-03-17 10:20:02 UTC
After updating Xamarin.Formst to 2.3.4-pre5, I experience the following:

Android app starts without runtime error, although the page is empty and the content it should display (and displays correctly when xaml compilation is off) is not there.

The UWP app still throws System.ExecutionEngineException.

Attaching the repro sample with the updated package references.
Comment 3 Gabor Nemeth 2017-03-17 10:20:50 UTC
Created attachment 20407 [details]
repro sample for XF 2.3.4.214-pre5
Comment 4 Stephane Delcroix 2017-03-27 12:27:00 UTC
The reproduction attached in comment #3 compile, and renders, just fine on Android, using the packages referenced by the project (XamlC is On).

Make sure the project is clean (or re-download yours), as stale artifacts could produce the issue you're seeing.