Not Able to Create PDF from PPT in C# Testing on Ubuntu WSL-Version: 2.2.4.0

Hello Support,
I get the exception bellow, when I convert PowerPoint to PDF on ubundu wsl (attached the VS test project. To reproduce run this command: “dotnet vstest TestAsposeSlidesTests.dll” ):

Failed RunTest [1 s]
Error Message:
Test method TestAsposeSlides.Tests.SlidesToPDFTests.RunTest threw exception:
System.PlatformNotSupportedException: System.Drawing.Common is not supported on this platform.
Stack Trace:
at System.Drawing.StringFormat.get_GenericTypographic()
at␦␦…ctor(Bitmap , Boolean)
at␦␦…ctor(Bitmap )
at␦…ctor(Int32 , Int32, Single , Single , Boolean , ␦␦ , , List1 ) at Aspose.Slides.Slide.(Boolean ,, ␦␦ , List1 , InterruptionToken )
at ␦.(Presentation , Stream, Int32[] , PdfOptions , InterruptionToken )
at ␦(Presentation , Stream, PdfOptions , InterruptionToken )
at Aspose.Slides.Presentation.Save(Stream stream, SaveFormat format, ISaveOptions options)
at Aspose.Slides.Presentation.Save(String fname, SaveFormat format)
at TestAsposeSlides.SlidesToPDF.Run(Stream pptExample) in C:\Users\vasil\Downloads\Aspose.Slides-for-.NET-master\TestAsposeSlides\TestAsposeSlides\Class1.cs:line 14
at TestAsposeSlides.Tests.SlidesToPDFTests.RunTest() in C:\Users\vasil\Downloads\Aspose.Slides-for-.NET-master\TestAsposeSlide
s\TestAsposeSlidesTests\SlidesToPDFTests.cs:line 22
at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr)

TestAsposeSlides.zip (216.8 KB)

@VasilisGiannoutsos,
Thank you for contacting free support. I am working on the issue and will get back to you soon.

@VasilisGiannoutsos,
Unfortunately, I was unable to reproduce the error you described. Could you please share additional instructions on how to do this?

Sorry can you clarify what you can not reproduce?
Do you mean, that you don’t get any error on your Ubuntu WSL instance from Windows?
I do follow steps:

  • open the attached project with VS 2022
  • build project
  • In PowerShell, start an Ubuntu WSL
  • mount directory and change to ptah: …TestAsposeSlides\TestAsposeSlidesTests\bin\Debug\net8.0
  • run test with command dotnet vstest TestAsposeSlidesTests.dll

@VasilisGiannoutsos,
Thank you for the additional information. I am working on the issue and will get back to you soon.

@VasilisGiannoutsos,
Thank you for your patience. I’ve reproduced the error you encountered.

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-44714

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.

@VasilisGiannoutsos,
Our developers have investigated the case. The PlatformNotSupportedException occurs because of Aspose.Slides for .NET 6.0 is being used which supports only Windows. In your example project this assembly is used instead of the .NET Standard version, as NuGet selects the most compatible assembly for the target project.

In this case, the selection is based on the TestAsposeSlidesTests project (.NET 8.0) rather than the TestAsposeSlides project (.NET Standard 2.0). For .NET 8.0, NuGet considers the .NET 6.0 assembly the most compatible version. Similarly, for .NET 6.0 and .NET 7.0, the .NET 6.0 version will also be chosen.
For .NET 5.0, .NET Core 3.x, and .NET Core 2.x projects, the Aspose.Slides .NET Standard assembly will be used, as there are no specific assemblies exist for these versions.

To resolve the issue, the .NET Standard version of Aspose.Slides should be explicitly referenced in the project. I’ve attached an updated version of the example.
TestAsposeSlidesUpdated.zip (271.2 KB)

The .NET Standard version of Aspose.Slides can be downloaded here: Download .NET DLL to Read Edit Presentations | Aspose.Slides