2
votes

I keep getting the error "Collection was modified; enumeration operation may not execute".

While in design mode for a winform. Project runs fine, just design time which has an issue.

This goes away after opening and closing the project X times (between 1 and 10+ so far), but always comes back at random times (even when no changes have been made to the project or any of its dependencies).

System.ThrowHelper.ThrowInvalidOperationException(ExceptionResource resource) at System.Collections.Generic.List1.Enumerator.MoveNextRare() at System.Collections.Generic.List1.Enumerator.MoveNext() at Microsoft.VisualStudio.Design.VSTypeResolutionService.AssemblySpecFound(List1 assemblies, String assemblyFullName) at Microsoft.VisualStudio.Design.VSTypeResolutionService.AddDependencies(Assembly a, String fileName) at Microsoft.VisualStudio.Design.VSTypeResolutionService.AssemblyEntry.get_Assembly() at Microsoft.VisualStudio.Design.VSTypeResolutionService.AssemblySpecFound(List1 assemblies, String assemblyFullName) at Microsoft.VisualStudio.Design.VSTypeResolutionService.AddProjectDependencies(Project project) at Microsoft.VisualStudio.Design.VSTypeResolutionService.AssemblyEntry.get_Assembly() at Microsoft.VisualStudio.Design.VSTypeResolutionService.AssemblyEntry.Search(String fullName, String typeName, Boolean ignoreTypeCase, Boolean allowPrivate, Assembly& assembly, String description) at Microsoft.VisualStudio.Design.VSTypeResolutionService.AssemblyEntry.Search(String fullName, String typeName, Boolean ignoreTypeCase, Assembly& assembly, String description) at Microsoft.VisualStudio.Design.VSTypeResolutionService.SearchProjectEntries(AssemblyName assemblyName, String typeName, Boolean ignoreTypeCase, Assembly& assembly) at Microsoft.VisualStudio.Design.VSTypeResolutionService.SearchEntries(AssemblyName assemblyName, String typeName, Boolean ignoreCase, Assembly& assembly, ReferenceType refType) at Microsoft.VisualStudio.Design.VSTypeResolutionService.SearchEntries(AssemblyName assemblyName, String typeName, Boolean ignoreTypeCase, Assembly& assembly) at Microsoft.VisualStudio.Design.VSTypeResolutionService.System.ComponentModel.Design.ITypeResolutionService.GetAssembly(AssemblyName name, Boolean throwOnError) at Microsoft.VisualStudio.Design.VSTypeResolutionService.System.ComponentModel.Design.ITypeResolutionService.GetAssembly(AssemblyName name) at Microsoft.VisualStudio.Design.VSDynamicTypeService.OnAssemblyResolve(Object sender, ResolveEventArgs e) at System.AppDomain.OnAssemblyResolveEvent(RuntimeAssembly assembly, String assemblyFullName) at System.Reflection.RuntimeAssembly.GetType(RuntimeAssembly assembly, String name, Boolean throwOnError, Boolean ignoreCase, ObjectHandleOnStack type) at System.Reflection.RuntimeAssembly.GetType(String name, Boolean throwOnError, Boolean ignoreCase) at Microsoft.VisualStudio.Design.VSTypeResolutionService.AssemblyEntry.Search(String fullName, String typeName, Boolean ignoreTypeCase, Boolean allowPrivate, Assembly& assembly, String description) at Microsoft.VisualStudio.Design.VSTypeResolutionService.AssemblyEntry.Search(String fullName, String typeName, Boolean ignoreTypeCase, Assembly& assembly, String description) at Microsoft.VisualStudio.Design.VSTypeResolutionService.SearchProjectEntries(AssemblyName assemblyName, String typeName, Boolean ignoreTypeCase, Assembly& assembly) at Microsoft.VisualStudio.Design.VSTypeResolutionService.SearchEntries(AssemblyName assemblyName, String typeName, Boolean ignoreCase, Assembly& assembly, ReferenceType refType) at Microsoft.VisualStudio.Design.VSTypeResolutionService.GetType(String typeName, Boolean throwOnError, Boolean ignoreCase, ReferenceType refType) at Microsoft.VisualStudio.Design.Serialization.CodeDom.AggregateTypeResolutionService.GetType(String name, Boolean throwOnError, Boolean ignoreCase) at Microsoft.VisualStudio.Design.Serialization.CodeDom.AggregateTypeResolutionService.GetType(String name) at System.ComponentModel.Design.Serialization.DesignerSerializationManager.GetRuntimeType(String typeName) at System.ComponentModel.Design.Serialization.DesignerSerializationManager.GetType(String typeName) at System.ComponentModel.Design.Serialization.DesignerSerializationManager.System.ComponentModel.Design.Serialization.IDesignerSerializationManager.GetType(String typeName) at System.ComponentModel.Design.Serialization.CodeDomSerializerBase.GetType(IDesignerSerializationManager manager, String name, Dictionary2 names) at System.ComponentModel.Design.Serialization.CodeDomSerializerBase.FillStatementTable(IDesignerSerializationManager manager, IDictionary table, Dictionary2 names, CodeStatementCollection statements, String className) at System.ComponentModel.Design.Serialization.TypeCodeDomSerializer.Deserialize(IDesignerSerializationManager manager, CodeTypeDeclaration declaration) at System.ComponentModel.Design.Serialization.CodeDomDesignerLoader.PerformLoad(IDesignerSerializationManager manager) at Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomDesignerLoader.PerformLoad(IDesignerSerializationManager serializationManager) at Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomDesignerLoader.DeferredLoadHandler.Microsoft.VisualStudio.TextManager.Interop.IVsTextBufferDataEvents.OnLoadCompleted(Int32 fReload)

1

1 Answers

2
votes

I think this was a bug that was fixed in Visual Studio 2012 Update 4:

Windows Forms

  • You may receive the following error message in Windows Forms Designer:

  • Collection was modified; enumeration operation may not execute

Go to Download Visual Studio 2012 Update 4 to get the update.