When Copying Slides, an Error Occurs when Saving "Consistency of Value Registry Is Broken"

Hi.
I’m using version “21.8.0” of Aspose.Slides.

When I run the following source, I get the error “Consistency of value registry is broken” when saving.
I have no idea why the error occurs.

please investigate.
Best regard.

Attach the source and files.

basefile.zip (78.6 KB)

try
{
    var basePpt = new Presentation(basePath);

    var targetSlide = basePpt.Slides[1];
    var movedSlide = basePpt.Slides.InsertClone(0, targetSlide);
    targetSlide.Remove();

    var targetSlide2 = basePpt.Slides[1];
    var movedSlide2 = basePpt.Slides.InsertClone(1, targetSlide2);
    targetSlide2.Remove();

    basePpt.Save(outPath, Aspose.Slides.Export.SaveFormat.Pptx);
}
catch (PptUnsupportedFormatException ex)
{
    var exPpt = new PptException("PPT/PPTXファイルではありません。", ex);
    throw exPpt;
}
catch (Exception ex)
{
    var exPpt = new PptException("エラーが発生しました。", ex);
    throw exPpt;
}

@yuya,
Thank you for the issue description. I reproduced the problem with cloning slides and logged the issue with ID SLIDESNET-42783 in our tracking system. Our development team will investigate this case. You will be notified when the problem is fixed.

I have observed the logic of your code snippet. As a workaround, I would suggest you to use another way to change slide order like this:

var basePpt = new Presentation("basefile.pptx");

var targetSlide = basePpt.Slides[1];
basePpt.Slides.Reorder(0, targetSlide);

basePpt.Save("basefile_out.pptx", SaveFormat.Pptx);

API Reference: SlideCollection Methods

1 Like

Hi.

Thank you for issuing the failure ticket.
We are waiting for it to be fixed.

Thanks for the workaround.
I’m keeping the source simple for the sample, so I’m not sure if this workaround is all right, but if it’s just sorting, there’s a method called Reorder, right?
Thank you for teaching me.

@yuya,
The ISlideCollection interface contains Reorder methods to move slides to a specified position.

API Referece:
ISlideCollection.Reorder (Int32, ISlide)
ISlideCollection.Reorder (Int32, ISlide[])

Thank you for the documentation.

Basically use ReOrder.
Do you mean that?

By the way, if this problem is solved, can you tell me what caused it?
The problem this time is, unlike the other obstacles I’ve mentioned in the forums, it’s unclear what causes the error.
I also want to know why ReOrder does not cause this problem.
I don’t know what the problem is so far, so I’m scared when it happens again.

Best regard.

@yuya,
Unfortunately, I have no information about the cloning problem cause. Our developers will find out what happened.

On the other hand, Reorder methods do not clone slides because they work differently and intend to change slide positions.

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

1 Like

Hi.

thank you for contacting. I will try using this version!