Collection was modified; enumeration operation may not execute

Hi Mario,

Am using the below loop to parse through all controls in the document. Getting an exception in the element collection as “Collection was modified; enumeration operation may not execute.”

foreach (IContentControl contentControl in document.GetChildElements(true, ElementType.InlineContentControl, ElementType.BlockContentControl))
{ }

This happens only for some content control fields and working fine for others.

Hi Minu,

Can you send us your Word file that reproduces this issue so that we can investigate it?

Regards,
Mario