Skip to content

EPPlus support for net6 on linux. #572

@gr3ysky

Description

@gr3ysky

I use EPPlus for export data as Excel files. Currently, System.Drawwing.Common is not supported for net6 applications runing under linux (as a docker image).

Here is the exception

//inner exception

              "ClassName" : "System.TypeInitializationException",
              "Message" : "The type initializer for 'Gdip' threw an exception.",
              "Source" : "System.Drawing.Common",
              "StackTraceString" : """   at System.Drawing.SafeNativeMethods.Gdip.GdipGetGenericFontFamilySansSerif(IntPtr& fontfamily)
   at System.Drawing.FontFamily.GetGdipGenericSansSerif()
   at System.Drawing.FontFamily.get_GenericSansSerif()
   at System.Drawing.Font.CreateFont(String familyName, Single emSize, FontStyle style, GraphicsUnit unit, Byte charSet, Boolean isVertical)
   at System.Drawing.Font..ctor(String familyName, Single emSize, FontStyle style, GraphicsUnit unit, Byte gdiCharSet, Boolean gdiVerticalFont)
   at OfficeOpenXml.ExcelRangeBase.AutoFitColumns(Double MinimumWidth, Double MaximumWidth)

-----
//actual exception
"ClassName" : "System.PlatformNotSupportedException",
              "Message" : "System.Drawing.Common is not supported on non-Windows platforms. See https://aka.ms/systemdrawingnonwindows for more information.",
              "Source" : "System.Drawing.Common",
              "StackTraceString" : """   at System.Drawing.LibraryResolver.EnsureRegistered()
   at System.Drawing.SafeNativeMethods.Gdip.PlatformInitialize()
   at System.Drawing.SafeNativeMethods.Gdip..cctor()""",


This was working on net5.
Is there a way to fix this?
Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions