I am using Xamarin.Forms 4.4.0.991640 and VS 2019 16.4.5
In one assembly (Demtech.AppCommon), I define a common resources xaml
<ResourceDictionary xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:d="http://xamarin.com/schemas/2014/forms/design" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" x:Class="Demtech.AppCommon.CommonResources"> <!-- My Resources --> </ResourceDictionary> public partial class CommonResources { public CommonResources() { InitializeComponent(); } }
and merge it with my Xamarin.Forms application
<Application xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:appCommon="clr-namespace:Demtech.AppCommon;assembly=Demtech.AppCommon" x:Class="ePollTab.Forms.ePollTabFormsApp"> <Application.Resources> <ResourceDictionary> <ResourceDictionary.MergedDictionaries> <appCommon:CommonResources/> </ResourceDictionary.MergedDictionaries> </ResourceDictionary> </Application.Resources> </Application>
Everything works great in UWP, but in iOS I am getting the exception
[0:] Position 6:10. Default constructor not found for type Demtech.AppCommon.CommonResources [0:] at Xamarin.Forms.Xaml.CreateValuesVisitor.Visit (Xamarin.Forms.Xaml.ElementNode node, Xamarin.Forms.Xaml.INode parentNode) [0x00363] in D:\a\1\s\Xamarin.Forms.Xaml\CreateValuesVisitor.cs:106 at Xamarin.Forms.Xaml.ElementNode.Accept (Xamarin.Forms.Xaml.IXamlNodeVisitor visitor, Xamarin.Forms.Xaml.INode parentNode) [0x000ac] in D:\a\1\s\Xamarin.Forms.Xaml\XamlNode.cs:155 at Xamarin.Forms.Xaml.ElementNode.Accept (Xamarin.Forms.Xaml.IXamlNodeVisitor visitor, Xamarin.Forms.Xaml.INode parentNode) [0x00044] in D:\a\1\s\Xamarin.Forms.Xaml\XamlNode.cs:149 at Xamarin.Forms.Xaml.RootNode.Accept (Xamarin.Forms.Xaml.IXamlNodeVisitor visitor, Xamarin.Forms.Xaml.INode parentNode) [0x00044] in D:\a\1\s\Xamarin.Forms.Xaml\XamlNode.cs:204 at Xamarin.Forms.Xaml.XamlLoader.Visit (Xamarin.Forms.Xaml.RootNode rootnode, Xamarin.Forms.Xaml.HydrationContext visitorContext, System.Boolean useDesignProperties) [0x00064] in D:\a\1\s\Xamarin.Forms.Xaml\XamlLoader.cs:223 at Xamarin.Forms.Xaml.XamlLoader.Load (System.Object view, System.String xaml, System.Reflection.Assembly rootAssembly, System.Boolean useDesignProperties) [0x00108] in D:\a\1\s\Xamarin.Forms.Xaml\XamlLoader.cs:103 at Xamarin.Forms.Xaml.XamlLoader.Load (System.Object view, System.String xaml, System.Boolean useDesignProperties) [0x00000] in D:\a\1\s\Xamarin.Forms.Xaml\XamlLoader.cs:75 at Xamarin.Forms.Xaml.XamlLoader.Load (System.Object view, System.Type callingType) [0x00029] in D:\a\1\s\Xamarin.Forms.Xaml\XamlLoader.cs:71 at Xamarin.Forms.Xaml.Extensions.LoadFromXaml[TXaml] (TXaml view, System.Type callingType) [0x00000] in <913f6dfae614433c9518842e97e9cf5c>:0 at ePollTab.Forms.ePollTabFormsApp.InitializeComponent () [0x00001] in D:\Projects\Demtech\DemtechSuite\Source\ePollTab\ePollTab.Forms\obj\Debug etstandard2.0\obj\Debug etstandard2.0\ePollTabFormsApp.xaml.g.cs:21 at ePollTab.Forms.ePollTabFormsApp..ctor () [0x00026] in D:\Projects\Demtech\DemtechSuite\Source\ePollTab\ePollTab.Forms\ePollTabFormsApp.xaml.cs:22 **System.Reflection.TargetInvocationException:** 'Exception has been thrown by the target of an invocation.'
I'm struggling to identify the issue/solution. Does anyone have any insight?