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.
PR #536 "ResourceDictionary fixes" was added in XF 2.3.4, but this now breaks under .NET native compilation.
The result? You get an empty ResourceDictionary and no XAML styles are applied in the compiled application.
Xamarin.Forms.Core/ResourceDictionary.cs, Line 30
_mergedInstance = s_instances.GetValue(_mergedWith,(key) => (ResourceDictionary)Activator.CreateInstance(key));
Activator.CreateInstance won't work with .NET native toolchain compilation.
See comment below on MSDN page ".NET Native and Compilation"
"Because the .NET Native tool chain links implementation code into your app only if it knows that your app actually invokes that code, either the metadata or the implementation code required in the following scenarios may not be included with your app: Reflection, Dynamic or late-bound invocation."
This is a critical issue, as it means you can't .NET native compile a XF 2.3.4 app on UWP.
Can a fix for this please be prioritised quickly?
We're trying to nail down a simple repro project for this. It appears that the problem doesn't happen under all instances, we are trying to trace it by enabling .NET Native static analysis and looking through any warnings generated.
Simple resource dictionaries don't always reproduce the problem. It is very odd. Also looking at whether it may be related to XAMLC. Once we pin it down, will post the repro project here.
OK, we have followed this through today and have found the issue is not with the ResourceDictionary but XAMLC and/or DataTriggers. We traced through a .NET native build in debug mode and found resource keys were being pulled OK, but not applied.
Applying the workaround here resolves the issue.
Therefore the description of this bug report is not entirely accurate after further investigation, but the root cause appears related to #56795. ResourceDictionary is not empty, but rather the resulting XAML styles are simply not applied.
*** This bug has been marked as a duplicate of bug 56795 ***