Getting error "System.Drawing.Common" is not supported in non-Windows Platforms

Hello,

We are getting the following error in Apose Total :
“System.Drawing.Common” is not supported in non-Windows Platforms

Thanks,
Mahesh
image.jpg (32.1 KB)

@MaheshChegu,

Thanks for the screenshot.

Could you please elaborate and provide more details about the issue, which Aspose for .NET APIs you are using? Also, share your complete environment details (OS, .NET framework version, other settings, etc.), sample code and sample file(s) to reproduce the issue. We will check and assist you accordingly.

PS. please zip the files prior attaching.

Hi,

We are working on two approaches. I am attaching code snippets for both the approaches

  1. Direct license name
  2. License file as a stream.

We are using the license “Aspose.Total.NET.LIC”, in our application. And our application is hosted on azure LinuxCode snippets.zip (822 Bytes)
platform.

@MaheshChegu,

Could you please turn on the runtime config switch “EnableUnixSupport” to support the drawing feature if you are using .NET 6 on non-windows platforms. For more information please refer to and follow up Microsoft’s official statement. Also see another document for further reference.

Please note, Aspose.Cells Team is working on the Graphics Library migration, and will use SkiaSharp to complete the migration in the future, as recommended in official statement of Microsoft.

Hi Amjad,

We tried both the approaches mentioned by you but still getting same error.

    1. Updated the runtime switch :- (turn on the runtime config switch “EnableUnixSupport” to support the drawing feature if you are using .NET 6 on non-windows platforms.)
    1. Also tried with the approach as suggested in https://stackoverflow.com/questions/70310747/net-6-system-drawing-common-runtime-switch

Can you please suggest anything else that we can try to resolve this?

@MaheshChegu,

We are sorry that the suggested workaround does not fix your issue. I am afraid, at the moment there is no other reliable workaround that you can try to cope with it.

By the way, I spotted you are doing auto-fitting operation and setting cells width in your code. The error might be due to these features/tasks. So, you may try to remove or comment out the line regarding auto-fit cols/rows operation if it works now. Alternatively, you may try to comment out both the lines:

......
sheet.AutoFitColumns();
sheet.Cells.StandardWidth = 20.5;  
.......

Hi @MaheshChegu
Please confirm system.drawing.common can run properly, such as:

        Bitmap image = new Bitmap(100, 100);
        Graphics g = Graphics.FromImage(image);
        g.Clear(Color.Red);
        image.Save("Test.png");

Can you run above code successful in your Azure environment? (just refer to system.drawing.common)

And, If it is indeed the exception like (“System.Drawing.Common” is not supported in non-Windows Platforms), it is the only solution currently available in net6 using system.drawing.common, as recommended by Microsoft.

Hi,

We have followed the approach as suggested in below link and closed it.

.NET 6 System.Drawing.Common Runtime Switch - Stack Overflow.

Thanks for your support.

Hi @Amjad_Sahi,
Was this the reason for Aspose to have dependencies to SkiaSharp?, and are we expected to see this going forward if we are using the latest version of Aspose?

@Joel_Peter

Yes, System.Drawing.Common is not working on non-windows platform with .Net 6 and above by default. And System.Drawing.Common works poorly on non-windows platform.

In the latest version of Aspose.Cells, we switched to SkiaSharp for .Net 6 and above. see document Run Aspose.Cells for .Net6 on Linux.

Nice, thank you. Now it makes sense. Good work team.

@Joel_Peter,

You are welcome.