Bug still exists: exception when reading presentations without Paragraphs

I’ve justed checked with Aspose.Slides for .Net 2.6.25.0 and got this stack trace for a slide without paragraphs:
Aspose.Slides.PptReadException: Couldn’t read “PowerPoint Document” record. —> System.Exception: Error reading bytes —> System.IndexOutOfRangeException: Index was outside the bounds of the array.
at ?.?.?(Byte[] ?, Int32 ?, Int32 ?)
at ?.?.FillFields(Byte[] data, Int32 offset, Int32 size)
at ?.?.?()
at ?.?.?(Object ?, Byte[] ?, Int32 ?, Int32 ?)
— End of inner exception stack trace —
at ?.?.?(Object ?, Byte[] ?, Int32 ?, Int32 ?)
at ?.?.FillFields(Byte[] data, Int32 offset, Int32 size)
at ?.?..ctor(Object root, Int16 id, Int32 offset, Int32 size, Byte[] data)
at ?.?.DoRead(BinaryReader reader)
at ?.?.?(? ?, BinaryReader ?)
at ?.?.?(Object ?, BinaryReader ?, Int32 ?)
at ?.?.DoRead(BinaryReader reader)
at ?.?.?(? ?, BinaryReader ?)
at ?.?.?(Object ?, BinaryReader ?, Int32 ?)
at ?.?.DoRead(BinaryReader reader)
at ?.?.?(? ?, BinaryReader ?)
at ?.?.?(Object ?, BinaryReader ?, Int32 ?)
at ?.?.DoRead(BinaryReader reader)
at ?.?.?(? ?, BinaryReader ?)
at ?.?.FillFields(Byte[] data, Int32 offset, Int32 size)
at ?.?..ctor(Object root, Int16 id, Int32 offset, Int32 size, Byte[] data)
at ?.?.?(Object ?, Int16 ?, Int16 ?, Int32 ?, Int32 ?, Byte[] ?, ? ?)
at ?.?.?(Object ?, Byte[] ?, Int32 ?, Int32 ?)
at ?.?.FillFields(Byte[] data, Int32 offset, Int32 size)
at ?.?..ctor(Object root, Int16 id, Int32 offset, Int32 size, Byte[] data)
at ?.?..ctor(Object root, Int16 id, Int32 offset, Int32 size, Byte[] data)
at ?.?.?(Object ?, Int16 ?, Int16 ?, Int32 ?, Int32 ?, Byte[] ?, ? ?)
at Aspose.Slides.Presentation.?(? ?)

Please, check what’s wrong cause it caused me lots of trouble. I thought that all problems with empty Paragraphs were gone with 2.6.22.0, but alas they are still here. I found the place in my code where I remove last Paragraph, I’ll fix it, but for the prospective users of Aspose.Slides it’s better to fix this small error ))

Dear Victor,

Please attach your source presentation and also code to view and fix the problem.

Presentation srcPres = new Presentation();
Slide s = srcPres.GetSlideByPosition(1);
s.AddNotes();
s.Notes.Paragraphs.RemoveAt(0);
srcPres.Write(“result.ppt”);
Presentation check = new Presentation(“result.ppt”);

Just use this code - you’ll get an exception at the last line.
As fo the fix - I meant that I added a check in my code:
if (s.Notes.Paragraphs.Count > 1)
s.Notes.Paragraphs.RemoveAt(0);

I didn’t mean any fixes for your code.

If I’m not mistaken I asked how first presentation was created, in MS PowerPoint or not.
So you mean we had to publish fix for notes just because you didn’t create it properly?

That is not a bug of Aspose.Slides. You should always control created or changed text and never delete all paragraphs. That is true not only for Notes but also for TextFrames and TextHolders. You have flexibility how to change text but you have to control paragraphs by yourself. If we prohibit deleting all paragraphs then most probably everybody will have large problems with text processing.

I don’t see any sense here. I don’t suggest removing zero from C# beacuse I can devide by zero. But in this situation if there are no paragraphs - why it is a bug?? It seems OK with me.

I mean you can at least throw exception when saving such presentations, because what’s the use of exception on reading it? I can’t even fix it, cause I can’t load it.

Then, if you exactly know that the problem is in missing paragraphs - why it is a problem? Why can’t you create notes without any paragraphs? Or add an empty paragraph in such cases?

Ppt presentation must have paragraphs in each text block. That is format of ppt file and we can’t change it. If there is no paragraph then ppt becomes broken. I understand that is not convenient for you but that is the only solution to create correct presentation. We will improve it and write some automatic filling of notes with empty paragraphs.

This problem has been fixed; please download the latest Aspose.Slides 2.6.26.0 from here

Read its blog.

http://www.aspose.com/Community/Blogs/aspose.slides/archive/2007/07/11/Aspose_Slides_for_Net_2_6_26_0_Released.aspx