Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
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
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.
Happens with Xamarin Forms versions starting with 126.96.36.199-pre2 - these were explicitly tested: 188.8.131.52-pre2, 184.108.40.206, 220.127.116.11, 18.104.22.168-pre5
Does not happen with Xamarin Forms versions before 22.214.171.124-pre2 - these were explicitly tested: 126.96.36.199
Before chaning Xamarin Forms version using NuGet, do "git clean -fdx" (to avoid any bin/obj leftovers).
Happens on any real device - explicitly tested: Nokia Lumia 930, Microsoft Lumia 650.
Does not happen on emulators.
Minimal project reproducing the issue: https://github.com/milan11/xamarin_forms_xaml_test
See project App2 (Porable), file MainPage.xaml. Any of the 3 marked elements cause that the Xaml is not loaded - the application crashes on NullReferenceException on line: label1.Text = "abc"; (because label1 is not bound)
Commenting out all the marked elements avoids the problem - app is loaded correctly.
After seeing maybe related bug https://bugzilla.xamarin.com/show_bug.cgi?id=53051 I tried to add
to Portable (Xamarin Forms) project's AssemblyInfo.cs, and then it always works correctly.
So, I am not sure if this is a bug or not.
Thank you for filing this report!
I ran the project you provided in the description and was able to reproduce this issue on a device. The app would crash at launch with the exception message:
> "System.Exception: Failed to create initial page\r\n at App2.Win.App.OnLaunched(LaunchActivatedEventArgs e)" string
debug output: https://gist.github.com/jimmgarrido/af0f891971b4c7c27df5c114ed09504d
As mentioned in comment 1, enabling XamlC does appear to resolve the issue. Also, this issue does _not_ occur when creating pages with code instead of xaml. However I am still confirming this report so the team can investigate further and provide more info.
Please use XamlC for Windows 8.1. If you are still seeing this issue with UWP (I am unable to reproduce using the UWP backend) please re-open.
This issue was seen only on 8.1. On UWP it does not happen.
However, the found workaround (enabling XamlC) causes another problems:
1. It fails static code analysis:
When compiling using msbuild with /p:RunCodeAnalysis=true:
MSBUILD : error : CA0001 : An error was encountered while parsing IL for method: 'XProject.YPage.InitializeComponent', instruction at offset '0x933' with opcode 'Callvirt'.
2. Building of the solution in Xamarin Studio (tried version 6.3 (build 864) on MAC) fails:
There is the error "Object reference not set to an instance of an object" for all xaml files in the project.
In another part of log, there is:
Parsing Xaml... done.
Replacing YPage.InitializeComponent ()... failed.
This unnecessarily complicates the solution configuration, since some projects have to be built with XamlC enabled and some (e.g. those we want to be compilable on MAC) with XamlC disabled.
Since this problem did not happen with Xamarin Forms versions before 188.8.131.52-pre2, I believe that it is possible for this bug to be really fixed (instead of using that XamlC workaround).