Hi there, I am facing an issue with System.Common.Drawing when I am trying to save a presentation. Stack trace:
Unhandled exception: System.TypeInitializationException: The type initializer for 'Gdip' threw an exception.
---> System.PlatformNotSupportedException: System.Drawing.Common is not supported on non-Windows platforms. See https://aka.ms/systemdrawingnonwindows for more information.
at System.Drawing.SafeNativeMethods.Gdip.<>c.<.cctor>b__2_0(String _, Assembly _, Nullable`1 _)
at System.Runtime.InteropServices.NativeLibrary.LoadLibraryCallbackStub(String libraryName, Assembly assembly, Boolean hasDllImportSearchPathFlags, UInt32 dllImportSearchPathFlags)
at System.Drawing.SafeNativeMethods.Gdip.<GdiplusStartup>g____PInvoke|32_0(IntPtr* __token_native, StartupInputEx* __input_native, StartupOutput* __output_native)
at System.Drawing.SafeNativeMethods.Gdip.GdiplusStartup(IntPtr& token, StartupInputEx& input, StartupOutput& output)
at System.Drawing.SafeNativeMethods.Gdip..cctor()
--- End of inner exception stack trace ---
at .(Size ,)
at .(Size )
at Aspose.Slides.Slide.GetThumbnail(Size imageSize)
I am trying to run Aspose.Total in a linux (debian) docker container. I have .NET version 8.0 and Aspose Total version 25.2.0.
The issue you are encountering with System.Drawing.Common not being supported on non-Windows platforms is a known limitation when using certain libraries in a Linux environment. Here are some suggestions to help you resolve this problem:
Use Aspose.Pdf.Drawing: If you are using Aspose.PDF, consider switching to Aspose.Pdf.Drawing, which does not have a dependency on System.Drawing. This can help avoid the platform compatibility issues you are facing.
Check for Updates: Ensure that you are using the latest version of Aspose.Total. Sometimes, newer versions may have addressed compatibility issues or provided alternative solutions.
Install libgdiplus: You mentioned that you added libgdiplus to your Dockerfile. Make sure that it is correctly installed and that your Docker container has access to it. This library is often required for System.Drawing to function on Linux.
Use SkiaSharp: Since you referenced the SkiaSharp.NativeAssets.Linux.NoDependencies package, ensure that you are correctly implementing it in your project. SkiaSharp can be a good alternative for graphics rendering on non-Windows platforms.
Provide Additional Information: If the issue persists, consider sharing more details such as the specific version of Aspose.Slides you are using, the .NET target platform, and any code examples that reproduce the error. This information can help in diagnosing the problem more effectively.
If you continue to experience difficulties, it may be beneficial to reach out to the Aspose support team with the additional information for further assistance.
Sources:
No specific sources were referenced in this response.
Can we reference Aspose.Total (25.3.0 (latest)) and a Aspose.Slides.NET6.CrossPlatform in the same class library as our class library requires access to various Aspose libraries (Word, PDF, Slides)?
Does an Aspose.Total license cover the use of Aspose.Slides.NET6.CrossPlatform?
I’ve tried installing Aspose.Slides.NET6.CrossPlatform package, which generates a file with “Evaluation only. Created with Aspose.Slides for .NET6 25.3. Copyright 2004-2025Aspose Pty Ltd.”. I have a metered OEM license, and I was wondering if this package would be included in that license.
I tried step 4 of your suggestion. You can use Aspose.Slides.NET6.CrossPlatform version of Aspose.Slides.
Just to clarify my previous query, when i mentioned
I’ve tried installing Aspose.Slides.NET6.CrossPlatform package, which generates a file with “Evaluation only. Created with Aspose.Slides for .NET6 25.3. Copyright 2004-2025Aspose Pty Ltd.”. I have a metered OEM license, and I was wondering if this package would be included in that license.
I was referring to macOS, which generates a file with “Evaluation only. Created with Aspose.Slides for .NET6 25.3. Copyright 2004-2025Aspose Pty Ltd.”.
I am still unable to save a presentation in a linux container.
Aspose.Slides for .NET 6+ and Aspose.Slides.NET6.CrossPlatform require GLIBC 2.23 (or higher) installed on Linux systems.
I have Debian 10, which uses GLIB v2.28.
One more thing to note here, I tried installing Aspose.Slides.NET6.CrossPlatform v25.2 nuget package, to keep it on par with Aspose.Total v25.2. However, saving a presentation fails with this.
Would it be possible to schedule a call to debug this issue with the support?
If you have a valid license for Aspose.Total, it should work with Aspose.Slides.NET6.CrossPlatform as well. Please ensure that the following code is executed in your application before any other operations with Aspose.Slides:
Aspose.Slides.Metered metered = new Aspose.Slides.Metered();
metered.SetMeteredKey("<valid public key>", "<valid private key>");
The Metered class should be used from the Aspose.Slides.NET6.CrossPlatform library.
Thanks for the pointer on setting keys for Aspose slides. I had missed that on my end. However, it seems that Aspose.Slides is referenced when the Metered class is used.
The Metered class should be used from the Aspose.Slides.NET6.CrossPlatform library.
How do I do this? The documentation referenced in the NuGet gallery leads to Aspose.Slides docs.
To ensure that only the cross‑platform build is referenced, three practical approaches exist.
Approach 1
Suppress the classic assembly that flows in through Aspose.Total and add the cross‑platform package. In the project file, update the transitive dependency so that the classic DLL is never copied, then reference Aspose.Slides.NET6.CrossPlatform explicitly:
<ItemGroup>
<PackageReference Include="Aspose.Total" Version="25.2.0" />
<!-- Silence the classic Aspose.Slides that Aspose.Total pulls in -->
<PackageReference Update="Aspose.Slides.NET"
ExcludeAssets="all"
PrivateAssets="all" />
<!-- Bring in the cross‑platform assembly -->
<PackageReference Include="Aspose.Slides.NET6.CrossPlatform" Version="25.2.0" />
</ItemGroup>
Approach 2
Replace Aspose.Total with only the individual Aspose packages actually needed and keep Aspose.Slides.NET6.CrossPlatform as a separate reference. This removes hidden duplication permanently if the project does not rely on every library included in the meta‑package.
Approach 3
Keep both assemblies side by side and disambiguate them with extern alias when some features require the GDI‑based classic build. Give each package a unique alias in the project file:
Then reference the desired implementation in code:
extern alias SlidesCrossPlatform; // cross‑platform version
extern alias SlidesClassic; // classic version, if ever required
using SlidesCrossPlatform::Aspose.Slides;
var presentation = new Presentation(); // resolved to cross‑platform version
Unless the project genuinely needs capabilities unique to the GDI‑based build, excluding the classic assembly or removing Aspose.Total altogether keeps the build cleaner and avoids accidentally loading the wrong DLL at runtime.
Thank you for the Dockerfile. I need some time to check the issue. I will get back to you as soon as possible.
I was able to run a Linux container using the Dockerfile you provided, create a presentation, and save it to a PPTX file. Please try using the attached sample project: SampleApp.zip (you only need to add the Aspose.Slides.NET6.CrossPlatform via NuGet).
I hope this will help you.
Thank you so much for your detailed answer. I’ve tried all your approaches, please see below:
Approach 1: My project file has the following content:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Aspose.Total" Version="25.2.0" />
<!-- Silence the classic Aspose.Slides that Aspose.Total pulls in -->
<PackageReference Update="Aspose.Slides.NET"
ExcludeAssets="all"
PrivateAssets="all" />
<!-- Bring in the cross‑platform assembly -->
<PackageReference Include="Aspose.Slides.NET6.CrossPlatform" Version="25.2.0" />
<PackageReference Include="DotNetEnv" Version="3.1.1" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
</ItemGroup>
</Project>
With this, I still get the same System.Drawing.Common is not supported on non-Windows platforms error.
Approach 2: I replaced the Aspose.Total package with Aspose.Words package and Aspose.Slides.NET6.CrossPlatform, both at v25.2.0. Running the project in docker container, I get following error:
Unhandled exception: System.TypeInitializationException: The type initializer for ‘’ threw an exception.
—> System.PlatformNotSupportedException: linux-arm64, Arm64
at .(String , Assembly, Nullable`1 )
at System.Runtime.InteropServices.NativeLibrary.LoadLibraryCallbackStub(String libraryName, Assembly assembly, Boolean hasDllImportSearchPathFlags, UInt32 dllImportSearchPathFlags)
at .d(Int32 d, Int32 v, Int32 c, IntPtr& t)
at System.Drawing.Bitmap…ctor(Int32 width, Int32 height, PixelFormat format)
at System.Drawing.Bitmap…ctor(Int32 width, Int32 height)
at …cctor()
— End of inner exception stack trace —
at …ctor(Presentation )
at tor(TextFrame )
at Aspose.Slides.TextFrame…ctor( )
at Aspose.Slides.AutoShape()
at.(Presentation )
at resentation )
at Aspose.Slides.Presentation…ctor(LoadOptions loadOptions)
at Aspose.Slides.Presentation…ctor()
Looks like this issue was previously logged Does Aspose.Slides for .NET Support ARM? and an update was added in v23.9. Any idea why I would be getting this error?
Approach 3: My project file has the following content:
@sudi.karmacharya,
I’ve reproduced the issues you described. We are sorry that you encountered these problems.
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.
Issue ID(s): SLIDESNET-44926
You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.
Just for my understanding, were you able to replicate all of the issues?
I understand time estimation is not included in free support services. Just want to get your thoughts on the issue. Does this seem like it can be resolved quickly, or would it be more of a feature change? Understanding the severity of these issues might be helpful in recalibrating the timeline on our end or possibly finding an alternative.
Out of curiosity, are these issues associated with one particular version? Is there a version where these issues may not come up?
@sudi.karmacharya,
Thank you for your questions. Yes, I replicated all the issues you described. Our developers have started to investigate the case.
The Dockerfile you provided uses a universal base image.
FROM debian:10
This is a generic image that supports multiple architectures, depending on how it’s pulled or built.
Could you please specify which architecture was used to build this Docker image and which host OS it was executed on?
This information will help us identify a possible solution to the issue.
I added a platform info in the docker file for linux/amd64. The host OS would be OSX, Sonoma 14.6.1 on an ARM-based arch.
Just an FYI (not sure if this changes anything on your end), I tried approach 2 with linux/amd64 in dockerfile. This generates a new error. See below:
Unhandled exception: System.TypeInitializationException: The type initializer for 'hrew an exception.
---> System.DllNotFoundException: Unable to load shared library 'libaspose.slides.drawing.capi_x86_64_libstdcpp_libc2.23' or one of its dependencies. In order to help diagnose loading problems, consider using a tool like strace. If you're using glibc, consider setting the LD_DEBUG environment variable:
/usr/share/dotnet/shared/Microsoft.NETCore.App/8.0.14/libaspose.slides.drawing.capi_x86_64_libstdcpp_libc2.23.so: cannot open shared object file: No such file or directory
libfontconfig.so.1: cannot open shared object file: No such file or directory
/usr/share/dotnet/shared/Microsoft.NETCore.App/8.0.14/liblibaspose.slides.drawing.capi_x86_64_libstdcpp_libc2.23.so: cannot open shared object file: No such file or directory
/application/app/DocumentService/bin/Release/net8.0/liblibaspose.slides.drawing.capi_x86_64_libstdcpp_libc2.23.so: cannot open shared object file: No such file or directory
/usr/share/dotnet/shared/Microsoft.NETCore.App/8.0.14/libaspose.slides.drawing.capi_x86_64_libstdcpp_libc2.23: cannot open shared object file: No such file or directory
/application/app/DocumentService/bin/Release/net8.0/libaspose.slides.drawing.capi_x86_64_libstdcpp_libc2.23: cannot open shared object file: No such file or directory
/usr/share/dotnet/shared/Microsoft.NETCore.App/8.0.14/liblibaspose.slides.drawing.capi_x86_64_libstdcpp_libc2.23: cannot open shared object file: No such file or directory
/application/app/DocumentService/bin/Release/net8.0/liblibaspose.slides.drawing.capi_x86_64_libstdcpp_libc2.23: cannot open shared object file: No such file or directory
at System.Runtime.InteropServices.NativeLibrary.LoadLibraryByName(String libraryName, Assembly assembly, Nullable`1 searchPath, Boolean throwOnError)
at .(String , Assembly, Nullable`1 )
at System.Runtime.InteropServices.NativeLibrary.LoadLibraryCallbackStub(String libraryName, Assembly assembly, Boolean hasDllImportSearchPathFlags, UInt32 dllImportSearchPathFlags)
at .d(Int32 d, Int32 v, Int32 c, IntPtr& t)
at System.Drawing.Bitmap..ctor(Int32 width, Int32 height, PixelFormat format)
at System.Drawing.Bitmap..ctor(Int32 width, Int32 height)
at ctor()
--- End of inner exception stack trace ---
at tor(Presentation )
at tor(TextFrame )
at Aspose.Slides.TextFrame..ctor )
at Aspose.Slides.AutoShape()
at .(Presentation )
at .(Presentation )
at Aspose.Slides.Presentation..ctor(LoadOptions loadOptions)
at Aspose.Slides.Presentation..ctor()
I have Aspose Words and Aspose.Slides.NET6.CrossPlatform packages in the project file.
However, I am facing another issue - this one is regarding the metered license.
I have metered license set for Words and Slides in the same file.
using WordsMetered = Aspose.Words.Metered;
using SlidesMetered = Aspose.Slides.Metered;
public static void SetAsposeWordsMeteredLicense()
{
......
// public and private keys set to string variables using env variables
WordsMetered wordsMetered = new WordsMetered();
wordsMetered.SetMeteredKey(publicKey, privateKey);
}
public static void SetAsposeSlidesMeteredLicense()
{
......
// public and private keys set to string variables using env variables
SlidesMetered slidesMetered = new SlidesMetered();
slidesMetered.SetMeteredKey(publicKey, privateKey);
}
I get the Authentication failed error only for Aspose slides. Just to experiment, I set keys only for Aspose Slides in this file, and the authentication still fails.
@sudi.karmacharya,
I’ve received your license keys. If I understand you correctly, the license keys are for Aspose.Total. Could you please confirm this?
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.