Skip to content

System.Drawing type errors with SkiaSharp.Views.Mac in F# Xamarin.Mac Modern project #1104

@danien

Description

@danien

When I try to open the SkiaSharp.Views.Mac namespace in an F# project targeting Xamarin.Mac Modern, I get a bunch of errors for a few System.Drawing types:

Error: A reference to the type 'System.Drawing.PointF' in assembly Xamarin.Mac was found,
but the type could not be found in the assembly.

including for Point, Size, SizeF, Rectangle, RectangleF.

This is with Visual Studio Mac 8.4.1 (build 4).

Screenshot 2020-01-16 at 12 22 38 PM

According to this Available Assemblies doc https://docs.microsoft.com/en-us/xamarin/cross-platform/internals/available-assemblies, System.Drawing is not supportedfor Xamarin.Mac Modern.

But it seems that there are extension methods in SkiaSharp.Views.Mac that use System.Drawing classes.

public static SKPoint ToSKPoint(this System.Drawing.PointF point)

The preprocessor directives wrapping the System.Drawing extension methods indicate that they will be included for Mac.

#if !WINDOWS_UWP && !__TIZEN__


However, a similar project in C# seems to work fine.

Could this be due to something that the F# project system does differently for the assemblies or can/should these System.Drawing extensions in SkiaSharp not be necessary for Mac (Modern target) since they aren't supported?

Here is a repo containing both C# and F# projects which are identical in function and does not use any System.Drawing types. https://github.com/danien/SkiaSharpViewsMacFSharpIssue
The F# project will not even build due to the above errors.

Any suggestions for how I can get around this issue if it can't be fixed, preferably without having to include the System.Drawing alternative mentioned in the Available Assemblies doc above since I don't really need it?

I'm not that familiar with the more advanced assemblies and project build systems in the .NET ecosystem so apologies in advance if I misunderstood something.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions