Possibile race condition saving pptx to stream

First of all, we haven’t found a way to replicate this consistently.

I’m working on this to give you as much context as possible, I will update the thread, in the meantime I would like to know what you think about that.

We suspect a race condition in the Presentation.Save method. We were able to observe this issue more than one time. Here is the exception stack trace:

ERROR: System.IndexOutOfRangeException: Index was outside the bounds of the array.
 at System.Collections.Generic.List`1.Enumerator.MoveNext()
 at Aspose.Slides.   .(String , ​   , Int32 , Single , FontStyle , Boolean )
 at Aspose.Slides.   .(String , ​   , Int32 , Single , FontStyle , Boolean )
 at Aspose.Slides.   .(String , ​   , Int32 , Single , FontStyle , Boolean )
 at Aspose.Slides.   .(Single )
 at Aspose.Slides.   .(Int32 ,     )
 at Aspose.Slides.   .()
 at Aspose.Slides.   ..ctor(TextFrame , Single , Single , IBaseSlide ,     )
 at Aspose.Slides.TextFrame.(Single , Single , IShapeStyle ,     )
 at Aspose.Slides.TextFrame.(ShapeFrame& , RectangleF& , Single& , Single& , Single& , Single& ,     )
 at Aspose.Slides.   .(IAutoShape ,     ,     ,     )
 at Aspose.Slides.   .(IShape ,     ,     ,     )
 at Aspose.Slides.   .(IGroupShape ,     ,     ,     )
 at Aspose.Slides.   .(IBaseSlide ,     ,     )
 at Aspose.Slides.   .(IMasterSlide , Boolean )
 at Aspose.Slides.   .(    , IMasterSlide , Boolean ,     )
 at Aspose.Slides.   .(IPresentation , Stream , PresentationTypeEx , IPptxOptions , InterruptionToken )
 at Aspose.Slides.Presentation.(Stream , PresentationTypeEx , IPptxOptions )
 at Aspose.Slides.Presentation.Save(Stream stream, SaveFormat format, ISaveOptions options)

Our code looks like this:

using (MemoryStream memStream = new MemoryStream())
{      
    // Save a presentation to stream, the exception is raised in the next line                            
    Presentation.Save(memStream, Aspose.Slides.Export.SaveFormat.Pptm);
    memStream.Position = 0;
    // create a new presentation starting from the stream
    Aspose.Slides.LoadOptions LoadOpt = new Aspose.Slides.LoadOptions(Aspose.Slides.LoadFormat.Auto);
    Aspose.Slides.Presentation ClonedPpt = new Aspose.Slides.Presentation(memStream, LoadOpt);
}

@andreagasparin,

I have observed your comments. Can you please share source file so that we may further investigate to help you out.

Hi, this is the presentation file

presentation.zip (205.7 KB)

@andreagasparin,

I have worked with source files and sample code shared by you and have been able to observe the issue. A ticket with ID SLIDESNET-40869 has been created in our issue tracking system to further investigate issue in detail. This thread has been linked with issue so that you may be automatically notified once issue will be fixed.

Hi there,

I’m getting this error too in my project. It’s working with some power point files but it’s failing with others at the moment. Same error: Index was outside the bounds of the array

This is the chunk of my code that it’s raising the exception:

public MemoryStream ApplyDocumentSpecificChanges(System.IO.MemoryStream file)
{
MemoryStream outputfile = new MemoryStream();
LoadFormat format = PresentationFactory.Instance.GetPresentationInfo(file).LoadFormat;
Presentation presentation = new Presentation(file);
switch (format)
{

case LoadFormat.Ppt:
presentation.Save(outputfile, Aspose.Slides.Export.SaveFormat.Ppt);
break;

}

}

In advance thank you for you help. BTW I’m new here and I don’t know how can I see the progress or status of the ticket SLIDESNET-40869?

Regards,

@oliverwym,

You can check the status of the issue from the bottom of page where the issue of status is mentioned as Open, Resolved, Postponed or Blocked. Also, when the issue gets resolved, automatic notification is sent to worth customers.

I don’t see the issue status you’re referring to. Please provide a link or screenshot to make this clear.

@pieris.christou,

Please check the attached image for the status for the issue.

Issue Status.png (46.7 KB)

@mudassir.fayyaz can’t view the png.
“Sorry, this file is private. Only visible to topic owner and staff members.”

@mudassir.fayyaz Same error that @pieris.christou here.

I can’t see the attached image.

Regards,

@oliverwym,

I have observed your comments. Can you please visit this link from where you can find image to guide you further. Also files in this thread will be only visible to thread owner and Aspose staff members.

@Adnan.Ahmad

Thank you. I’m able to see the image now. Please let us know the progress because the resolution can fix my current issue.

@oliverwym,

We will share updates with you as soon as the issue will be fixed.

1 Like

The issues you have found earlier (filed as SLIDESNET-40869) have been fixed in this update.