I have been trying to develop a Xamarin application making use of Xamarin Forms and .Net Standard 2.0 class libraries, but I am finding that they seem to be very buggy. I was under the impression that Xamarin / mono framework is supposed to be completely .net standard 2 compliant.
As a simple example, i created a new xamarin forms project in VS2017 Pro (15.8.2), with code sharing strategy set to .Net Standard. I then added a new .net standard class library to the solution and referenced it from the .Android project. In the class library i created a simple Enum and a simple class with a function that takes an enum as a parameter and uses the .HasFlag to check for a value. In the xamarin forms main page i added a button which when pressed creates an instance of the class from the .net standard class library, and calls the function with a fixed value from the enum. When i run this code in the Android simulator it works perfectly, however as soon as I try to run it on my actual Android device it fails on the .HasFlag call with the error "Object of type System.Int32 cannot be converted to type System.Enum".
The simulator Android OS version i tried was the latest 8.1 and also tested on 4.4. The device i was testing on was also 4.4. I was using Xamarin Live Player to deploy and test.
So my question is why does this simple thing fail on the device?
This is not the only issue I have faced, I also found that the System.Drawing namespace that is part of the .NetStandard 2 spec also fails. I was just using it for the Color definitions and the Rectangle and Point structures as I was intending to do some rendering with SkaiSharp. I know SkiaSharp has its own versions of these so i was able to effectively remove all uses of those classes, however it again seems to indicate another .net standard 2 thing that doesnt actually work with xamarin.
I feel like I must be missing something obvious, Xamarin has been around for quite a while as far as I know and I would expect these sort of issues would affect others too if they were legit bugs.
I have attached a copy of the sample solution that is generating the .HasFlag error on my Android device if anyone needs it, otherwise its easy enough to repo from a new project as explained.
Any help would be much appreciated,
FYI my VS2017 Xamarin Versions are
Xamarin Designer 4.14.221
Xamarin Templates - 1.1.116
Xamarin.Android SDK 220.127.116.11
Xamarin.iOS and Xamarin.Mac SDK 18.104.22.168
Mono Debugging for VS 4.11.8-pre