The Template Builder may fail when saving templates with many fields


Description

This issue only occurs when Sitecore CMS is installed on systems that have Microsoft security update MS11-100 installed (or where the update was installed and then uninstalled, since the Microsoft security update does not support uninstalling).

On such systems, using the Template Builder to edit and save templates that have a large number of sections and fields (approximately more than 160), the following unhandled exceptions may occur:

“ArgumentNullException: Null ids are not allowed.”

or

“InvalidOperationException: Operation is not valid due to the current state of the object.”

Solution

Add the following node to the <appSettings> section of the web.config file:

<add key="aspnet:MaxHttpCollectionKeys" value="5000" />

The default value of the setting is 1000, so the value of 5000 corresponds to a limit of approximately 800 template sections and fields. 

For more information about the setting, see the following Microsoft KB article:
http://support.microsoft.com/kb/2661403