Exception: Collection was modified; enumeration operation may not execute on TableOfEntries.Update()

Hi there, I’m getting this weird error when updating the TableOfEntries object. I tried this both on version 35.0.0.1574 and the latest 35.0.1869, and it’s the same. Here are the details:

Exception message: “Collection was modified; enumeration operation may not execute.”

at System.ThrowHelper.ThrowInvalidOperationException(ExceptionResource resource) in System\ThrowHelper.cs:line 60
at System.Collections.Generic.List1.Enumerator.MoveNextRare() in System.Collections.Generic\List.cs:line 222 at GemBox.Document.ElementCollection1..MoveNext()
at t..MoveNext()
at t..MoveNext()
at t..MoveNext()
at t..MoveNext()
at t..MoveNext()
at x..MoveNext()
at x.(TableOfEntries )
at .ExcelService.Word.WordTemplateService.GenerateTemplateByte(DocX templateDocument, String html, DocumentDto documentDto, String docType) in C:\\ExcelService\Word\WordTemplateService.cs:line 714

Here is the word document thats triggering this exception: Click Here!

Hi David,

I’m getting Access Denied for that document’s link.
Please try sharing it again.

Regards,
Mario

Sorry, didn’t set the link to public, now it should be ok.

Hi David,

Please try again with this NuGet package:

Install-Package GemBox.Document -Version 35.0.1883-hotfix

Note that this is a hidden pre-released version, to install it you’ll need to run the above command on the NuGet Package Manager Console (Tools → NuGet Package Manager → Package Manager Console).

Regards,
Mario

1 Like