diff --git a/src/AddIns/DisplayBindings/FormsDesigner/Project/Src/Services/TypeDiscoveryService.cs b/src/AddIns/DisplayBindings/FormsDesigner/Project/Src/Services/TypeDiscoveryService.cs index adc4f90e26..aca6c79988 100644 --- a/src/AddIns/DisplayBindings/FormsDesigner/Project/Src/Services/TypeDiscoveryService.cs +++ b/src/AddIns/DisplayBindings/FormsDesigner/Project/Src/Services/TypeDiscoveryService.cs @@ -39,7 +39,9 @@ namespace ICSharpCode.FormsDesigner.Services + "excludeGlobalTypes=" + excludeGlobalTypes.ToString()); //seek in all assemblies //allow to work designers like columns editor in datagridview - foreach (Assembly asm in TypeResolutionService.DesignerAssemblies) { + // Searching types can cause additional assemblies to be loaded, so we need to use + // ToArray to prevent an exception if the collection changes. + foreach (Assembly asm in TypeResolutionService.DesignerAssemblies.ToArray()) { AddDerivedTypes(baseType, asm, types); } LoggingService.Debug("TypeDiscoveryService returns " + types.Count + " types"); diff --git a/src/AddIns/Misc/MonoAddIn/Project/Src/MonoGacReferencePanel.cs b/src/AddIns/Misc/MonoAddIn/Project/Src/MonoGacReferencePanel.cs index 77347bf68d..5bdefdb703 100644 --- a/src/AddIns/Misc/MonoAddIn/Project/Src/MonoGacReferencePanel.cs +++ b/src/AddIns/Misc/MonoAddIn/Project/Src/MonoGacReferencePanel.cs @@ -8,6 +8,7 @@ using ICSharpCode.Build.Tasks; using ICSharpCode.SharpDevelop.Gui; using System; +using System.Collections.Generic; using System.Windows.Forms; namespace ICSharpCode.MonoAddIn