Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic "Collection was modified; enumeration operation may not execute." (Read 1971 times)
j poz
Junior Member
**
Offline


I Love MindFusion!

Posts: 78
Joined: Nov 21st, 2012
"Collection was modified; enumeration operation may not execute."
Mar 18th, 2014 at 3:21pm
Print Post  
We are running into an issue whereby DiagramView.OnMouseMove is throwing an InvalidOperationException.. Not exactly sure what's happening, but here is the stack trace:

---------------------------------------------------------------
   at System.Collections.Generic.List`1.Enumerator.MoveNextRare()
   at MindFusion.Diagramming.Selection.VisitHierarchy(ItemVisitor visitor)
   at MindFusion.Diagramming.Diagram.DrawInteraction(IGraphics graphics, RenderOptions options, RectangleF clipRect)
   at MindFusion.Diagramming.WinForms.Behaviors.BehaviorBase.OnMouseMove(Point mousePosition)
   at MindFusion.Diagramming.WinForms.DiagramView.OnMouseMove(MouseEventArgs e)
   at System.Windows.Forms.Control.WmMouseMove(Message& m)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: "Collection was modified; enumeration operation may not execute."
Reply #1 - Mar 18th, 2014 at 4:47pm
Print Post  
This might happen if you change selection state of items from a custom-draw event or custom items' Draw override? That would modify the Selection object's collections while Selection.VisitHierarchy runs with a PainterVisitor, and throw on next iteration.
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint