Skip to main content
A newer version of this page is available. .
All docs
V22.1

System.Drawing.Common is Supported on Windows Only

  • 2 minutes to read

With the release of .NET 6, the System.Drawing.Common library is compatible with Windows only. See the following Microsoft documentation topic for more information: System.Drawing.Common only supported on Windows.

An application that is built for non-Windows platforms throws the following exception:

System.TypeInitializationException : The type initializer for 'Gdip' threw an exception.

This breaking change affects DevExpress Reporting as we use the System.Drawing.Common library to render reports.

Use one of the following options to fix this issue:

  • Replace the System.Drawing.Common library with the earlier version 5.0.3.

    Version 5.0.3 retains compatibility with Linux, MacOS, and other platforms. An application built for these platforms does not throw the exception described above. Note that Microsoft does not issue fixes for non-Windows bugs and vulnerabilities.

  • As a temporary workaround, enable the System.Drawing.EnableUnixSupport configuration property to prevent the exception on non-Windows platforms. You should add a runtimeconfig.template.json file to your project with the following code:

    {
        "configProperties": {
            "System.Drawing.EnableUnixSupport": true
        }
    }
    

    This file is a template for the runtimeconfig.json files generated by your project. For more information, review the following help topic in Microsoft documentation: .NET Runtime configuration settings.

    Note that Microsoft plans to stop checking this configuration property in future releases. Once this change is implemented, applications that use System.Drawing.Common will always throw the exception above on non-Windows platforms.