Multithreading CloneSlide Error



We had been using Aspose.PowerPoint v2.0.2.0 and recently upgraded to Aspose.Slides v2.4.14.0 (the latest version). Our application is multithreaded generating PowerPoint documents on background threads. Since the upgrade we get an error “Object is currently in use elsewhere” if we revert the old version the error is gone, nothing changed in our code other then the namespace from PowerPoint to Slides. Each thread runs in a bubble, no objects are shared between them. They create there own Presentation objects.

Thank you for your time,


Here is the call stalk:

System.InvalidOperationException was unhandled by user code
Message="Object is currently in use elsewhere."
at System.Drawing.Graphics.MeasureString(String text, Font font, PointF origin, StringFormat stringFormat)
at ಩.಩.಩(೤ ಩, ೤ ಩, Portion ಩, Single& ಩)
at ಩.಩.಩(Boolean ಩)
at ಩.಩..ctor(Graphics Graphics, Paragraphs Text, ಩ Fonts, Single Width, Boolean WrapText, AnchorText Anchor, Tabs Tabs, Color BackgroundColor)
at Aspose.Slides.TextFrame.಩()
at Aspose.Slides.Shape.಍()
at Aspose.Slides.Rectangle.಍()
at Aspose.Slides.Shape.਷()
at Aspose.Slides.Presentation.਷(Boolean ಩)
at Aspose.Slides.Slide.಩(Presentation ಩)
at Aspose.Slides.Presentation.಩(Slide ಩, Presentation ಩, SortedList ಩)
at Aspose.Slides.Presentation.CloneSlide(Slide srcSlide, Int32 position)
at ...


Attached is a sample VS 2005 project that provokes the error.


I couldn’t run your example because I use VS 2003.
Looks like there is a problem with multithreading inside Graphics.MeasureString.
Thank you, we will investigate it and fix.


Here is the complied version of the test application. With the default settings of the application it will fail but if you use the "simple slide" or change for the previous version of Aspose.PowerPoint then the error is gone. I hope this can help you. Thank you for the quick response.

Note: Requires .Net 2.0 Smile [:)]



Dear Stefane,

Please check new 2.5.1 version of Aspose.Slides.
We have fixed problem with multithreading in CloneSlide method.