I have a xamarin PCL that builds fine in x86 Debug mode. When I switch it to Release Mode (x86 or x64) or x64 Debug, I am getting runtime exceptions. It probably relates to
but I don't know what other assembly I'm using. How can I tell?
My computer is x64. When I run x64 in either debug or release I get
Exception "System.NotImplementedException" in MyApp.Interop.dll. Additional Info Arg_NotImplementedException.
Before entering the constructor App(). The call to the constructor is here:
LoadApplication(new MyApp.App());
When I build x86 I get a little bit further. It gets into the MyAppConstructor and calls the xaml constructor and gives exception:
System.Reflection.MissingMetadataException in System.Private.Reflection.Core.dll AdditionalInfo:Arg_InvokeMethodMissingMetadata, System.EventHandler. For more information, visit http://go.microsoft.com/fwlink/?LinkId=623485
So it looks like a Xaml assembly I'm missing. How do I find out what assembly I need to add?
I put it back on Debug, but turned it to "use the Native Compiler" so I could get more details on the exceptions:
x86: Additional information: Cannot create a delegate on type 'System.EventHandler' as it is missing metadata for the Invoke method. For more information, please visit http://go.microsoft.com/fwlink/?LinkID=616867
x64: An exception of type 'System.NotImplementedException' occurred in Xamarin.Forms.Platform.UAP.dll but was not handled in user code
Additional information: The method or operation is not implemented.
UPDATE: I am guessing x64 is not supported in Xamarin because no mobile product has x64 processor? Still leaves the problem with the x86 release. I have tried adding the following assemblies in my Universal App.xaml.cs
List<Assembly> assembliesToInclude = new List<Assembly>();
assembliesToInclude.Add(typeof(MyApp.MyAppMainPage).GetTypeInfo().Assembly);
assembliesToInclude.Add(typeof(Xamarin.Forms.ImageSource).GetTypeInfo().Assembly);
assembliesToInclude.Add(typeof(Xamarin.Forms.StackLayout).GetTypeInfo().Assembly);
assembliesToInclude.Add(typeof(Xamarin.Forms.Label).GetTypeInfo().Assembly);
assembliesToInclude.Add(typeof(Xamarin.Forms.Button).GetTypeInfo().Assembly);
assembliesToInclude.Add(typeof(Xamarin.Forms.FormattedString).GetTypeInfo().Assembly);
assembliesToInclude.Add(typeof(Xamarin.Forms.Span).GetTypeInfo().Assembly);
assembliesToInclude.Add(typeof(Xamarin.Forms.Image).GetTypeInfo().Assembly);
assembliesToInclude.Add(typeof(Xamarin.Forms.ScrollView).GetTypeInfo().Assembly);
assembliesToInclude.Add(typeof(Xamarin.Forms.WebView).GetTypeInfo().Assembly);
// add this line
Xamarin.Forms.Forms.Init(e,assembliesToInclude); // requires the `e` parameter
where MyAppMainPage is the xaml page I try to load in my PCL and the rest are the UI elements that the page is made up of.
I now see this Exception thrown for x86:
'System.PlatformNotSupportedException' in System.Private.Interop.dll Exception thrown: 'System.AggregateException' in System.Private.Threading.dll Exception thrown: 'System.Reflection.MissingMetadataException' in System.Private.Reflection.Core.dll
Why would the platform not be supported? Xamarin supports Universal right?