Saving a PPT File in C# Returns an Unclear Error without System.Drawing.Common

The following code will returns a confusing exception

using (var presentation = new Presentation())
{
    presentation.Save(path, SaveFormat.Ppt);
}

Error:

System.NullReferenceException : Object reference not set to an instance of an object.

If trying to save to Pptm or Pptx, then the error is clear:

System.PlatformNotSupportedException : System.Drawing.Common is not supported on this platform.

Please make the exception clear when using Ppt as well.

@mr1304,
Thank you for contacting support.

To investigate the case and help you, we need more details. Please share the following additional information:

  • OS version on which the code was executed
  • .NET target platform in your app
  • Aspose.Slides version you used

Hi Andrey,

Thank you for the response!

  • I am running on Windows 10 22H2
  • .NET version 8
  • Aspose.Slides.NET latest version, 24.2.0

@mr1304,
Thank you for the details. Unfortunately, I was unable to reproduce the errors you described.

Typically, this error can occur in non-Windows systems. Could you please check the issue carefully and provide additional information to reproduce the errors you encountered?