PresentationPlayer.GetFrame Method Throws AccessViolationException in C#

I get the below error when attempting to call GetFrame on a slide that has an image on it with an animation. If I remove the animation, it works perfectly.

Fatal error. System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
Repeat 2 times:
--------------------------------
   at ♠♥▬♥☻.h(IntPtr, Single ByRef)
--------------------------------
   at System.Drawing.Image.get_HorizontalResolution()
   at ☼☻☼↨.☻↨☻♣, Single, System.Drawing.SizeF, ☼☻←♥, Double ByRef, Double ByRef)
   at ☼☻☼↨.☻(☼♣☻↨, System.Drawing.SizeF, ☼►▬▬, Aspose.Slides.IBaseSlide, Boolean)
   at Aspose.Slides.Picture.☻(☼♣☻↨, System.Drawing.SizeF, ☼►▬▬, Aspose.Slides.IBaseSlide, Boolean)
   at ♠☻☼↨..ctor(☼♣☻↨, Aspose.Slides.EffectFormat, Aspose.Slides.PictureFillFormat, Boolean)
   at ☻↓☻▬.☻↓☻▬←☼→☻(☼♣▬▬, Aspose.Slides.ShapeFrame, System.Drawing.Drawing2D.GraphicsPath, ♣▬→▬[], Aspose.Slides.ShapeElementFillSource, Aspose.Slides.IFillParamSource, ☼►▬▬)
   at ☻↓☻▬.☻(☼♣▬▬, ☼►▬▬, Aspose.Slides.ShapeElement[], Aspose.Slides.ShapeFrame, Aspose.Slides.IFillParamSource, Aspose.Slides.IPictureFillFormat)
   at ♫☻☼↨.☻↓☻▬←☼→☻(☼♣▬▬, ☼►▬▬, Aspose.Slides.ShapeElement[], Aspose.Slides.ShapeFrame, Aspose.Slides.IEffectFormatEffectiveData, ☻)
   at ♫☻☼↨.☼↑☻▬←☼→☻(☼♣▬▬, ☼►▬▬, Aspose.Slides.InterruptionToken)
   at ☼►▬▬.☼►▬▬←☼→☻(☼♣▬▬, Aspose.Slides.Shape, Aspose.Slides.InterruptionToken)
   at ♫↓↑▬.☻(☼♣▬▬, Aspose.Slides.Shape, Aspose.Slides.InterruptionToken)
   at ♫↓↑▬.☼►▬▬←☼→☻(☼♣▬▬, Aspose.Slides.Shape, Aspose.Slides.InterruptionToken)
   at→→▬.♥(☼♣▬▬, ☼►▬▬, Aspose.Slides.InterruptionToken)
   at→→▬.☼↑☻▬←☼→☻(☼♣▬▬, ☼►▬▬, Aspose.Slides.InterruptionToken)
   at ♥←→←.♣(☼♣▬▬, ☼►▬▬, Aspose.Slides.InterruptionToken)
   at ♥←→←.☻(☼♣▬▬, Aspose.Slides.IShapeFrame, ☼►▬▬, Boolean, Boolean, Aspose.Slides.InterruptionToken)
   at ♥←→←.☻(System.Drawing.Size, ☼►▬▬)
   at↑↓▬.GetFrame()
   at Aspose.Slides.Export.FrameTickEventArgs.GetFrame()

@pauldeg,
Thank you for contacting support.

Please check your results using the latest version of Aspose.Slides for .NET if it is possible. If the issue persists, please share the following files and information:

  • input presentation file
  • code example that reproduces the exception
  • OS version on which the code was executed
  • .NET target platform in your app
  • Aspose.Slides version you used

The above was based off Aspose.Slides.NET v23.5.0

Is that not the latest version?

The following is a code snippet to reproduce:

Target Framework is .net 7 on Windows 11

    var Fps = 33;
    List<string> frames = new List<string>();
    using (var animationsGenerator = new PresentationAnimationsGenerator(pm.Presentation))
    using (var player = new PresentationPlayer(animationsGenerator, Fps))
    {
        player.FrameTick += (sender, args) =>
        {
            try
            {
                string frame = $"frame_{(sender.FrameIndex):D4}.png";
                args.GetFrame().Save(frame);
                frames.Add(frame);
            }
            catch (Exception e)
            {
                Console.WriteLine("Error: " + $"frame_{(sender.FrameIndex):D4}.png");
            }
        };
        animationsGenerator.Run(pm.Presentation.Slides);
    }

Presentation reporting.zip (62.7 KB)

@pauldeg,
Thank you for the details. We will get back to you as soon as possible.

@pauldeg,
I reproduced the exception you are encountering.

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

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.

The issues you found earlier (filed as SLIDESNET-44068) have been fixed in Aspose.Slides for .NET 23.8 (ZIP, MSI).
You can check all fixes on the Release Notes page.
You can also find the latest version of our library on the Product Download page.