Skip to content

'System.Drawing is not supported on this platform' when instantiating XFont in Xamarin.Forms UWP #11

@mohitatray

Description

@mohitatray

I am using this library in Xamarin.Forms common project. I have added a UWP project in my solution. When I run my UWP app and try to instantiate XFont, I get the following exception --

Exception thrown: 'System.PlatformNotSupportedException' in System.Drawing.Common.dll
An exception of type 'System.PlatformNotSupportedException' occurred in System.Drawing.Common.dll but was not handled in user code
System.Drawing is not supported on this platform.

The exception occurs at this line --
var xFont = new XFont("Helvetica", 12, XFontStyle.Regular);
I have added this nuget package in both the common project and the UWP project.

Expected behaviour: No exception should occur.
Actual behaviour: Exception occurs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions