We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Error on Kubernetes/Linux || System.Drawing.Common is not supported on non-Windows platforms for method on Aspose.Cells.Worksheet.AutoFitColumns()

Hello Aspose Support,
We have a lic for Aspose.Total and reaching out to you for support on one pof the error we encountered recently.

Untill now we were hosting our .net web applications on to windows based azure appservices and started on migrating to Kubernates with linux as platform.
Upon moving to linux, we encountered the with cells.Automapcolumsn() [below the error details]. In the forum i saw it is fixed in Aspose.Cells version 22.x and we upgraded to 24.x but still no luck.

Can you help fix this issue?
Look forward for your response

Error stack trace:

{“ClassName”:“System.TypeInitializationException”,“Message”:“The type initializer for ‘Gdip’ threw an exception.”,“Data”:null,“InnerException”:{“ClassName”:“System.PlatformNotSupportedException”,“Message”:“System.Drawing.Common is not supported on non-Windows platforms. See https://aka.ms/systemdrawingnonwindows for more information.”,“Data”:null,“InnerException”:null,“HelpURL”:null,“StackTraceString”:" at System.Drawing.LibraryResolver.EnsureRegistered()\n at System.Drawing.SafeNativeMethods.Gdip.PlatformInitialize()\n at System.Drawing.SafeNativeMethods.Gdip…cctor()",“RemoteStackTraceString”:null,“RemoteStackIndex”:0,“ExceptionMethod”:null,“HResult”:-2146233031,“Source”:“System.Drawing.Common”,“WatsonBuckets”:null},“HelpURL”:null,“StackTraceString”:" at System.Drawing.SafeNativeMethods.Gdip.GdipStringFormatGetGenericTypographic(IntPtr& format)\n at System.Drawing.StringFormat.get_GenericTypographic()\n at \u0006 …cctor()",“RemoteStackTraceString”:null,“RemoteStackIndex”:0,“ExceptionMethod”:null,“HResult”:-2146233036,“Source”:“System.Drawing.Common”,“WatsonBuckets”:null,“TypeName”:“Gdip”},“HelpURL”:null,“StackTraceString”:" at \u0006 .\u0002(String \u0002, Single \u0003, FontStyle \u0005)\n at \u000e .\u0002(String \u0002, Font \u0003, Double \u0005)\n at \u0002 .\u0002(Int32 \u0002, Int32 \u0003, Int32 \u0005, Int32 \b, AutoFitterOptions \u0006)\n at \u0002 .\u0002(Cells \u0002, Int32 \u0003, Int32 \u0005, Int32 \b, Int32 \u0006, AutoFitterOptions \u000e)\n at Aspose.Cells.Worksheet.AutoFitColumns()\n


You may try to workaround the issue with libgdiplus in Linux environment with .Net 6 by enabling EnableUnixSupport setting in runtimeconfig.json as per Microsoft documentation.

Please note, we will develop (new) supported versions to fix GDI and other issues which will eliminate the dependencies of System.Drawing.Common and libgdiplus on non-Windows platforms. But since the task itself involves complexities so this is not going to be implemented/supported any time soon. Our plan is to implement in sync when the official version of .NET 7 will be released by Microsoft.

@Amjad_Sahi Thank you for the response.

We tried EnableUnixSupport setting but no luck.
So we have to wait until .Net 7 release , are there any timelines for your implementation ? any alternate recommendations ?



We are sorry that the suggested workaround did not fix your issue.

There is no timeline or ETA at the moment, once we have it, we will update you. We will get back to you if we have some other recommendations.