Note that there are some explanatory texts on larger screens.

plurals
  1. POSystem.InvalidOperationException: Collection was modified; enumeration operation may not execute when form closes
    text
    copied!<h1><strong>I fixed this issue by removing the line shapes from the form.</strong></h1> <h1>Original Post</h1> <p>When my form closes I get the following error:</p> <blockquote> <blockquote> <p>System.InvalidOperationException: Collection was modified; enumeration operation may not execute</p> </blockquote> </blockquote> <p>This only appears when the program is deployed on a machine not during debug. If I hide the form it doesn't occur only when the form is closed.</p> <p>Any help is greatly appreciated as this is becoming really annoying now. Thanks in advance,<br/> Craig</p> <p>p.s. Below is the FormClosed event</p> <pre><code> 'Disconnect from database cn.Close() cn.Dispose() </code></pre> <h3>Stack Trace</h3> <pre><code> ************** Exception Text ************** System.InvalidOperationException: Collection was modified; enumeration operation may not execute. at System.ThrowHelper.ThrowInvalidOperationException(ExceptionResource resource) at System.Collections.Generic.List`1.Enumerator.MoveNextRare() at System.Collections.Generic.List`1.Enumerator.MoveNext() at Microsoft.VisualBasic.PowerPacks.ShapeCollection.Dispose(Boolean disposing) at Microsoft.VisualBasic.PowerPacks.ShapeContainer.Dispose(Boolean disposing) at System.ComponentModel.Component.Dispose() at System.Windows.Forms.Control.Dispose(Boolean disposing) at System.ComponentModel.Component.Dispose() at System.Windows.Forms.Control.Dispose(Boolean disposing) at System.Windows.Forms.TabControl.Dispose(Boolean disposing) at System.ComponentModel.Component.Dispose() at System.Windows.Forms.Control.Dispose(Boolean disposing) at System.Windows.Forms.Form.Dispose(Boolean disposing) at EquiManager.frmEditJumpingShow.Dispose(Boolean disposing) at System.ComponentModel.Component.Dispose() at System.Windows.Forms.Form.WmClose(Message&amp; m) at System.Windows.Forms.Form.WndProc(Message&amp; m) at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message&amp; m) at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message&amp; m) at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload