Legend Error

Feb 2, 2011 at 7:05 PM

I am getting the following Legend Error when trying to move layer posotions:

DotSpatial.Controls.dll!.Controls.Legend.OnMouseUp(System.Windows.Forms.MouseEventArgs e) Line 686

System.InvalidOperationException was unhandled
  Message=Collection was modified; enumeration operation may not execute.
  Source=mscorlib
  StackTrace:
       at System.ThrowHelper.ThrowInvalidOperationException(ExceptionResource resource)
       at System.Collections.Generic.List`1.Enumerator.MoveNextRare()
       at System.Collections.Generic.List`1.Enumerator.MoveNext()
       at DotSpatial.Controls.GeoLayerEnumerator.MoveNext() in c:\Dev\DotSpatial\DotSpatial.Controls\DotSpatial.Controls\MapLayerEnumerator.cs:line 86
       at DotSpatial.Controls.MapFrame.Initialize(List`1 regions) in c:\Dev\DotSpatial\DotSpatial.Controls\DotSpatial.Controls\MapFrame.cs:line 394
       at DotSpatial.Controls.MapFrame.Initialize() in c:\Dev\DotSpatial\DotSpatial.Controls\DotSpatial.Controls\MapFrame.cs:line 455
       at DotSpatial.Controls.MapFrame.Invalidate() in c:\Dev\DotSpatial\DotSpatial.Controls\DotSpatial.Controls\MapFrame.cs:line 601
       at DotSpatial.Controls.Legend.OnMouseUp(MouseEventArgs e) in c:\Dev\DotSpatial\DotSpatial.Controls\DotSpatial.Controls\Legend.cs:line 683
       at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
       at System.Windows.Forms.Control.WndProc(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
       at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
       at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
       at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
       at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
       at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
       at System.Windows.Forms.Application.Run(ApplicationContext context)
       at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
       at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
       at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)
       at DVMS_GIS.My.MyApplication.Main(String[] Args) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 81
       at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
       at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
  InnerException: