If InfoPath Form is having issues while attaching any document to the form during the Edit mode of the form.
Attachments are working fine when New Item is created, but having issues with the Edit Form
Issue Resolution:
In order to fix this, we need to make some Web.Config changes and have to add the following tag.
<appSettings>
<add key="aspnet:MaxHttpCollectionKeys" value="4000" />
</appSettings>
Issue Caused By:
The error traced from the logs is “Operation is not valid due to the current state of the object”.
This will happen due to the post back control size limit. If there are more number of controls in the post back submission of any page, it causes the above mentioned issue. Actually the Form is quite big and having a lot of controls.