System.Drawing issue type mismatch, but origin???

Kevin A 121 Reputation points
2021-03-12T12:04:02.587+00:00

Hi, Have a problem with an exception that I cannot discover because the line feedback is too trivial.
What I really need to get, rather than just a line reference at high level to "App.xaml.cs:26 ", which shows a type problem. This should give me an idea where in the application the mismatch is occurring, not just in the InitializeComponent () line, and then off to MS code land.

Xamarin.Forms.Xaml.XamlParseException
Message=Position 9:37. Type converter failed: Could not resolve type with token 01000073 from typeref (expected class 'System.Drawing.Color' in assembly 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51')
Source=Xamarin.Forms.Xaml
StackTrace:
at Xamarin.Forms.Xaml.ApplyPropertiesVisitor.SetPropertyValue (System.Object xamlelement, Xamarin.Forms.Xaml.XmlName propertyName, System.Object value, System.Object rootElement, Xamarin.Forms.Xaml.INode node, Xamarin.Forms.Xaml.HydrationContext context, System.Xml.IXmlLineInfo lineInfo) [0x0007d] in D:\a\1\s\Xamarin.Forms.Xaml\ApplyPropertiesVisitor.cs:366
at Xamarin.Forms.Xaml.ApplyPropertiesVisitor.Visit (Xamarin.Forms.Xaml.ValueNode node, Xamarin.Forms.Xaml.INode parentNode) [0x0007b] in D:\a\1\s\Xamarin.Forms.Xaml\ApplyPropertiesVisitor.cs:60
at Xamarin.Forms.Xaml.ValueNode.Accept (Xamarin.Forms.Xaml.IXamlNodeVisitor visitor, Xamarin.Forms.Xaml.INode parentNode) [0x00000] in D:\a\1\s\Xamarin.Forms.Xaml\XamlNode.cs:91
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:152
at Xamarin.Forms.Xaml.FillResourceDictionariesVisitor.Visit (Xamarin.Forms.Xaml.ElementNode node, Xamarin.Forms.Xaml.INode parentNode) [0x00150] in D:\a\1\s\Xamarin.Forms.Xaml\FillResourceDictionariesVisitor.cs:61
at Xamarin.Forms.Xaml.ElementNode.Accept (Xamarin.Forms.Xaml.IXamlNodeVisitor visitor, Xamarin.Forms.Xaml.INode parentNode) [0x00012] in D:\a\1\s\Xamarin.Forms.Xaml\XamlNode.cs:147
at Xamarin.Forms.Xaml.ListNode.Accept (Xamarin.Forms.Xaml.IXamlNodeVisitor visitor, Xamarin.Forms.Xaml.INode parentNode) [0x00025] in D:\a\1\s\Xamarin.Forms.Xaml\XamlNode.cs:235
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:152
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:209
at Xamarin.Forms.Xaml.XamlLoader.Visit (Xamarin.Forms.Xaml.RootNode rootnode, Xamarin.Forms.Xaml.HydrationContext visitorContext, System.Boolean useDesignProperties) [0x0007e] in D:\a\1\s\Xamarin.Forms.Xaml\XamlLoader.cs:235
at Xamarin.Forms.Xaml.XamlLoader.Load (System.Object view, System.String xaml, System.Reflection.Assembly rootAssembly, System.Boolean useDesignProperties) [0x000a2] in D:\a\1\s\Xamarin.Forms.Xaml\XamlLoader.cs:104
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:77
at Xamarin.Forms.Xaml.XamlLoader.Load (System.Object view, System.Type callingType) [0x00029] in D:\a\1\s\Xamarin.Forms.Xaml\XamlLoader.cs:73
at Xamarin.Forms.Xaml.Extensions.LoadFromXaml[TXaml] (TXaml view, System.Type callingType) [0x00000] in D:\a\1\s\Xamarin.Forms.Xaml\ViewExtensions.cs:37
at OurApp.App.InitializeComponent () [0x00001] in C:\FMW\repos\OurApp_Apps\OurApp\obj\Debug\netstandard2.0\App.xaml.g.cs:21
at OurApp.App..ctor () [0x00027] in C:\FMW\repos\OurApp_Apps\OurApp\App.xaml.cs:26
at OurApp.Droid.MainActivity.OnCreate (Android.OS.Bundle savedInstanceState) [0x0003b] in C:\FMW\repos\OurApp_Apps\Droid\MainActivity.cs:45
at Android.App.Activity.n_OnCreate_Landroid_os_Bundle_ (System.IntPtr jnienv, System.IntPtr native__this, System.IntPtr native_savedInstanceState) [0x00010] in /Users/builder/azdo/_work/278/s/xamarin-android/src/Mono.Android/obj/Release/monoandroid10/android-29/mcw/Android.App.Activity.cs:2691
at (wrapper dynamic-method) Android.Runtime.DynamicMethodNameCounter.7(intptr,intptr,intptr)

Appreciate any insight.

Managed to solve by using: <Reference Include="netstandard" /> in the CProj file.

which is an old hack, from https://github.com/dotnet/standard/issues/542

Xamarin
Xamarin
A Microsoft open-source app platform for building Android and iOS apps with .NET and C#.
5,325 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Kevin A 121 Reputation points
    2021-03-15T10:59:40.897+00:00

    Hi, as mentioned, I solved the problem because of the issue noted at
    https://github.com/dotnet/standard/issues/542

    Its origin I don't know. There were no problems with colors or changes in the app that affected colors.

    0 comments No comments