We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

System.IndexOutOfRangeException: 'Index was outside the bounds of the array.' WordDocument.Save with parallelism


I'm encountering an error when trying to save an SFDT string to a .docx file. The error specifically is System.IndexOutOfRangeException: 'Index was outside the bounds of the array.' This is occurring when calling the following method:

Syncfusion.EJ2.DocumentEditor.WordDocument.Save(file.Contents, Syncfusion.EJ2.DocumentEditor.FormatType.Docx);

More info as follows:

I am using .Net Core 3.1 with SF packages DocIO.Net.Core, DocIORenderer.Net.Core, EJ2.WordEditor.ASPNET.Core - all version 21.1.39. I don't think it's relevant, but the frontend is using Vue.js (2.7x), and @syncfusion/ej2-vue-documenteditor version 21.1.37. 

The documents are rendering perfectly in the browser, and I am sending 3 docs to the backend to be converted into documents then combined into a single PDF. I had previously been using an earlier version of Syncfusion.EJ2.DocumentEditor.WordDocument version which worked flawlessly.

Of note, I am calling this in parallel which I think is contributing to the issue. When I remove the parallelism, its saves all of the documents correctly. Again, this was working in the previous version mentioned above, so I'd like to keep it running in parallel if possible.

It errors out on the same document, but if I process just that single document and save it, it works, which makes me think it has to do with the parallelism. I tried removing the image in the document that is erroring but it still threw the same error.

Any help would be appreciated.

Thank you.

20 Replies

KM Kavitha Muralitharan Syncfusion Team April 17, 2023 05:53 AM UTC

Doug, we suspect that the reported problems are might be due to the contents in the input word document which used at your end. We need to investigate with the contents in your input Word document to reproduce the exact problem at our end. So, could you please provide us the input Word document which used at your end and share the details of issue if you faced any in console and a video reference of the replication procedure. Thereby, we will analyze further and provide you the appropriate solution at the earliest.

Note: If you have any confidential data in your Word document, please replace with some dummy data and provide us the same. We just need your document to recreate the problem you face.

DT Doug Thierjung April 18, 2023 12:31 AM UTC

Thank you Kavitha,

I uploaded a version of the word doc that is experiencing the error.

if I have time I'll try to compile more error info.

Attachment: Application_Excess_825ef3c7.zip

KM Kavitha Muralitharan Syncfusion Team April 18, 2023 02:05 PM UTC

Hi Doug,


We recommend that you upgrade both the client and server sides to the latest version (v21.1.41)  packages. Please upgrade and try it on your end. Also, please cross-check to ensure that if the issue persists, kindly share the sample codes you have used with the replication video for further validation.

NPM Link: (Client-side)



NuGet link: (Server-side)




Kavitha M

DT Doug Thierjung April 19, 2023 01:11 AM UTC

It looks like the server side version is maxing out at v21.1.39 - are there newer versions

KM Kavitha Muralitharan Syncfusion Team April 19, 2023 07:32 AM UTC

Yes, Doug.

The latest version is V21.1.41 Please try it and let us know if you need any other assistance.

NuGet link: (Server-side)



DT Doug Thierjung April 20, 2023 03:43 AM UTC

I downloaded 21.1.41 for both the frontend and backend, however the error is still persisting. Were you able to encounter the error?

Through various testing, it appears to be tied to sending at least 3 documents into the parallel loop as the error does not occur on this form if I run it by itself, or with one other document.

I'll see if I can put together a sample project to re-create.

Thank you.

KM Kavitha Muralitharan Syncfusion Team April 20, 2023 09:15 AM UTC

Doug, kindly share the sample codes you have used with the replication procedure video for further validation.

DT Doug Thierjung April 21, 2023 06:44 PM UTC

I created a basic reproduction of the necessary logic in the attached .Net application. It should have everything to reproduce the error mentioned above.

If you switch the `Parallel.ForEach` to a normal `foreach` loop, the program should not error out. 

Let me know if you need anything else to debug.

Thank you.

Attachment: SfErrorSample_887a5249.zip

KM Kavitha Muralitharan Syncfusion Team April 24, 2023 02:51 PM UTC

Doug, Could you share the replication procedure video with error facing on your end for the exact replication and further validation ?

DT Doug Thierjung April 24, 2023 03:14 PM UTC

Sure, please see attached. If you launch the reproduction, it should run and encounter the error automatically.

Attachment: Error_Recording_b981f20.zip

KM Kavitha Muralitharan Syncfusion Team April 25, 2023 02:34 PM UTC

Doug, currently, we are checking the issue and will get back to you by April 27, 2023.

KM Kavitha Muralitharan Syncfusion Team April 27, 2023 05:19 AM UTC

Hi Doug,

We can reproduce the reported issue with provided Sample. Currently, we are validating and will get back to you by May 3, 2023.


Kavitha M

DT Doug Thierjung April 27, 2023 03:19 PM UTC

Thank you for your time on this.

KM Kavitha Muralitharan Syncfusion Team May 1, 2023 03:44 AM UTC

Thanks for your update, Doug.

We will get back to you by May 3, 2023.

SM Suriya Murugan Syncfusion Team May 5, 2023 10:31 AM UTC

Doug, Currently, we are validating on this and will update details once completed.

DT Doug Thierjung May 15, 2023 03:16 PM UTC


Would you be able to provide a status update?

Thank you.

DT Doug Thierjung May 23, 2023 02:43 PM UTC

Checking in on the status of this one. Please let me know.

Thank you.

SM Suriya Murugan Syncfusion Team May 24, 2023 07:46 AM UTC

Doug, we have confirmed the reported issue 'Resolve the exception while saving multiple document in parallel'
as a defect and logged a defect report. We will fix this issue in our weekly release which is expected for the first week of June 2023. 

You can track the status of the bug through the below feedback link:


Disclaimer: “Inclusion of this solution in the weekly release may change due to other factors including but not limited to QA checks and works reprioritization.”

TV Thamizhselvan Varadharajan Syncfusion Team June 7, 2023 01:33 PM UTC


We are glad to announce that our patch release (v21.2.9) has been rolled out successfully. In this ‎release, we have added the fix for the issue Resolve the exception while saving multiple document in parallel.‎

Please upgrade to the latest version packages to resolve this issue:‎

CDN links:‎


NuGet links:‎



Feedback link:


Please let us know if you need any further assistance.‎

DT Doug Thierjung June 7, 2023 04:39 PM UTC

Fantastic! Appreciate your help with all this.

Live Chat Icon For mobile
Up arrow icon