Since converting our inhouse winforms application from the VS2008 project to VS2012, I have been having problems using the winforms constructor.
Sometimes a designer gets into an error state, causing the following error message:
"The collection has been modified; an enumeration operation cannot be performed." with a call stack saying:
Instances of this error (1) 1. Hide Call Stack at System.ThrowHelper.ThrowInvalidOperationException(ExceptionResource resource) at System.Collections.Generic.List`1.Enumerator.MoveNextRare() at System.Collections.Generic.List`1.Enumerator.MoveNext() at Microsoft.VisualStudio.Design.VSTypeResolutionService.AssemblySpecFound(List`1 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.SearchByShortName(String partialName, String fullName, AssemblyEntry[] entries, Assembly& assembly) at Microsoft.VisualStudio.Design.VSTypeResolutionService.SearchNormalEntries(AssemblyName assemblyName, String typeName, Boolean ignoreTypeCase, Assembly& assembly, Boolean fastSearch) 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)
It seems that the designer is trying to change the list of reference assemblers, possibly due to some invalid builds. When I tried to solve the problem, I realized that changing the "Enable ClickOnce Security function" option in Project-> Properties-> Security can cause the designer to return to work. BUT, if the option is enabled, and I get a constructor error, turning it off and restoring everything, from time to time VICE VERSA can solve the problem !!!! ... That's why I got a little lost right now.
Lazygeek
source share