I have an Xamarin.iOS project that uses the splat library https://github.com/paulcbetts/splat to make System.Drawing types available in portable class library. If a parent class uses (say) System.Drawing.RectangleF, then by using Splat, it works just fine to subclass this class in Xamarin.IOS code. However, the same is not true of Xamarin.Mac, at least not the way I am doing it. Various types conflict with themselves -- at a minimum Point and RectangleF.
I don't know if this is related to Xamarin's recent updates (to Xamarin 6) or not.
Some sample code is below, and I'm making a full project demonstrating the problem available on Github. https://github.com/verybadcat/splat -- macbug branch.
It looks similar to the problem described here [Splat [0.3.4] on Xamarin.iOS: issues with RectangleF and PointF.
Portable Class Library project:
using System.Drawing;
namespace PCL
{
public class RectOwner
{
public RectangleF Rect { get; set;}
}
}
IOS project -- this works just fine:
using PCL;
namespace IOSApp
{
public class RectOwnerIOS: RectOwner
{
public RectOwnerIOS ()
{
this.Rect = new System.Drawing.RectangleF (10, 20, 30, 40);
}
}
}
Mac project -- does not build:
using PCL;
namespace MacApp
{
public class RectOwnerSubclass: RectOwner
{
public RectOwnerSubclass ()
{
this.Rect = new System.Drawing.RectangleF (5, 6, 7, 8); // errors here:
// /Users/william/Documents/splat/MacApp/RectOwnerMac.cs(16,16): Error CS7069: Reference to type `System.Drawing.RectangleF' claims it is defined assembly `Splat, Version=1.6.2.0, Culture=neutral, PublicKeyToken=null', but it could not be found (CS7069) (MacApp)
// /Users/william/Documents/splat/MacApp/RectOwnerMac.cs(23,23): Error CS0029: Cannot implicitly convert type `System.Drawing.RectangleF [Xamarin.Mac, Version=0.0.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065]' to `System.Drawing.RectangleF [Splat, Version=1.6.2.0, Culture=neutral, PublicKeyToken=null]' (CS0029) (MacApp)
}
}
}
How can I get the Mac project to build?