Free Support Forum - aspose.com

Invalid Operation error while cloning slides

Getting this error while trying to add clone slide :

Presentation master= new Presentation(this.getClass().getClassLoader().getResourceAsStream("src/main/resources/slide.pptx"));

Presentation presentation = new Presentation(); 
presentation.getSlides().removeAt(0);
presentation.getSlides().addClone(master.getSlides().get_Item(0));

I am passing the master slide to several methods and executing those methods in parallel. I don’t get any issue when executing them sequentially.
com.aspose.slides.exceptions.InvalidOperationException: Trying to add new cached value with the same keys.

@agarwalsarthak121

There is issue in your used code. You are cloning the master slide in normal slide with is not right. You need to use the correct slide type for cloning is respecting collection.

Thanks. I was able to figure out the issue.

@agarwalsarthak121

It’s good to know things are working fine on your end as per suggestion.