"InvalidOperationException: out of sync" at ChartData.writeWorkbookStream


sporadically we get an “InvalidOperationException” while the method call “ChartData.writeWorkbookStream”. During a test, we got this error 16 times out of 431. So, unfortunately, we cannot reproduce it. The use case during the error occurs is quite complex. Basically, it’s about changing ChartData values as we did here:

  1. Changing the chart data values by using IChartData.getSeries() and IChartData.getCategories().
  2. Changing the workbook values by using IChartData.readWorkbookStream() and IChartData.writeWorkbookStream(byte[]).

This is done with certain parallelism:

  • one thread per PowerPoint
  • one thread per slide
  • one thread per shape (e.g. Chart)
    I’m not sure if the parallelism is the problem. But it might be…

Can you explain a bit why / how the InvalidOperationException occurs during writeWorkbookStream?

Meanwhile we are investigating the issue further. Maybe we can find a pattern or a way to reliably reproduce it.

This is the stack trace

com.aspose.slides.exceptions.InvalidOperationException: out of sync
at com.aspose.slides.Collections.Generic.Dictionary$Enumerator.for(Unknown Source)
at com.aspose.slides.Collections.Generic.Dictionary$Enumerator.hasNext(Unknown Source)
at com.aspose.slides.Collections.Generic.Dictionary$ValueCollection$Enumerator.hasNext(Unknown Source)
at com.aspose.slides.internal.dd.if.do(Unknown Source)
at com.aspose.slides.internal.dd.if.do(Unknown Source)
at com.aspose.slides.internal.dd.if$1.do(Unknown Source)
at com.aspose.slides.internal.de.do.int(Unknown Source)
at com.aspose.slides.internal.de.try.new(Unknown Source)
at com.aspose.slides.internal.dd.if.do(Unknown Source)
at com.aspose.slides.internal.dd.if.do(Unknown Source)
at com.aspose.slides.anb.do(Unknown Source)
at com.aspose.slides.ano.for(Unknown Source)
at com.aspose.slides.ano.do(Unknown Source)
at com.aspose.slides.ChartDataWorkbook.do(Unknown Source)
at com.aspose.slides.ChartDataWorkbook.(Unknown Source)
at com.aspose.slides.ChartData.do(Unknown Source)
at com.aspose.slides.ChartData.writeWorkbookStream(Unknown Source)
at de.knowis.isf.rep.bl.vorlage.pptx.replace.shape.ChartShapeReplacer.saveWorkbook(ChartShapeReplacer.java:101)



a small update. This (7.6 KB)
is the analysis of the “out of sync” error per slide. This (220.8 KB)
is the template, we are using for the test.



Can you please share complete sample project reproducing issue along with environment details so that we may further investigate to help you out.


of course I knew you would say that :wink:. Unfortunately, as I wrote, it’s a complex use case. I will create a sample project to reproduce the issue, but that takes some time. I will share the project once it’s finished.


Sure, We are waiting for your response.