Persits Software, Inc. Knowledge Base Articles

AspPDF.NET Error: Collection was modified; enumeration operation may not execute.

Problem Description

When using AspPDF.NET under certain conditions, the following exception may occur:

Collection was modified; enumeration operation may not execute.

Solution

The problem has been resolved as of Service Release 3.7.0.34914. If you are using an earlier version, please upgrade at www.asppdf.net.

We successfully replicated this error in a multi-threaded environment and identified the root cause as the "Optimize code" option in Visual Studio. Disabling this option and recompiling the component resolved the issue.