Bug 40743 - Custom Views don't work when using .NET native tool chain
Summary: Custom Views don't work when using .NET native tool chain
Alias: None
Product: Forms
Classification: Xamarin
Component: Windows ()
Version: 2.0.0
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Samantha Houts [MSFT]
Depends on:
Reported: 2016-04-27 20:34 UTC by Michael Kitzman
Modified: 2017-06-19 23:31 UTC (History)
4 users (show)

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

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:

Description Michael Kitzman 2016-04-27 20:34:18 UTC
The project ZXing.Net.Mobile has a Xamarin Forms version of the popular ZXing barcode scanning library.  The library uses custom view renderers for each platform.  Each platform works in Debug builds, but Windows UWP platform doesn't work when the compile option "Compile with .NET native tool chain" is enabled.

Without this option enabled, Xamarin forms is able to construct the custom renderers via reflection, however, with this option enabled, throws a "FileNotFound" exception during the initialization of the Application.

Here is a call stack from the exception being thrown in th Sample Forms application in that project when compiling the UWP app in release.

System.Private.Reflection.Core.dll!System.Reflection.Runtime.Assemblies.RuntimeAssembly.GetRuntimeAssembly(Internal.Reflection.Core.ReflectionDomain reflectionDomain, System.Reflection.Runtime.Assemblies.RuntimeAssemblyName assemblyRefName) Line 46	C#
 	System.Private.Reflection.Core.dll!System.Reflection.Runtime.General.ReflectionCoreCallbacksImplementation.Load(System.Reflection.AssemblyName refName) Line 45	C#
 	System.Private.Reflection.dll!System.Reflection.Assembly.Load(System.Reflection.AssemblyName assemblyRef) Line 114	C#
 	Xamarin.Forms.Platform.UAP.dll!Xamarin.Forms.Platform.UWP.WindowsBasePlatformServices.GetAssemblies()	Unknown
 	Xamarin.Forms.Core.dll!Xamarin.Forms.Device.GetAssemblies()	Unknown
 	Xamarin.Forms.Core.dll!Xamarin.Forms.Registrar.RegisterAll(System.Type[] attrTypes)	Unknown
 	Xamarin.Forms.Platform.UAP.dll!Xamarin.Forms.Forms.Init(Windows.ApplicationModel.Activation.IActivatedEventArgs launchActivatedEventArgs, System.Collections.Generic.IEnumerable<System.Reflection.Assembly> rendererAssemblies)	Unknown
	WindowsUniversal.exe!WindowsUniversal.App.OnLaunched(Windows.ApplicationModel.Activation.LaunchActivatedEventArgs e) Line 65	C#
Comment 1 Samantha Houts [MSFT] 2017-01-04 18:10:03 UTC
Please try adding the dll to the list of assemblies to include, as per the instructions here:


Does this resolve your issue?

Warm regards,
Xamarin.Forms Team
Comment 2 Samantha Houts [MSFT] 2017-06-19 23:31:44 UTC
Because we have not received a reply to our request for more information we are closing this issue. If you are still encountering this issue, please reopen the ticket with the requested information. Thanks!