Bug 3590 - System.InvalidOperationException: Collection was modified; enumeration operation may not execute.
Summary: System.InvalidOperationException: Collection was modified; enumeration operat...
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: Debugger ()
Version: Trunk
Hardware: PC Linux
: --- normal
Target Milestone: ---
Assignee: Jeffrey Stedfast
Depends on:
Reported: 2012-02-22 11:39 UTC by Marek Safar
Modified: 2012-02-23 12:04 UTC (History)
1 user (show)

Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Marek Safar 2012-02-22 11:39:19 UTC
System.InvalidOperationException: Collection was modified; enumeration operation may not execute.
  at System.Collections.Generic.List`1+Enumerator[Mono.Debugging.Client.BreakEvent].VerifyState () [0x0003c] in /home/marek/git/mono/mcs/class/corlib/System.Collections.Generic/List.cs:790 
  at System.Collections.Generic.List`1+Enumerator[Mono.Debugging.Client.BreakEvent].MoveNext () [0x00000] in /home/marek/git/mono/mcs/class/corlib/System.Collections.Generic/List.cs:796 
  at Mono.Debugging.Client.BreakpointStore.GetBreakpointsAtFile (System.String filename) [0x0004f] in /home/marek/git/monodevelop/main/src/core/Mono.Debugging/Mono.Debugging.Client/BreakpointStore.cs:178 
  at MonoDevelop.SourceEditor.SourceEditorView.UpdateBreakpoints (Boolean forceUpdate) [0x001a5] in /home/marek/git/monodevelop/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/SourceEditorView.cs:983 
  at MonoDevelop.SourceEditor.SourceEditorView.<OnBreakpointStatusChanged>m__44 () [0x0000c] in /home/marek/git/monodevelop/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/SourceEditorView.cs:1061 
  at GLib.Timeout+TimeoutProxy.Handler () [0x0000c] in /home/marek/git/gtk-sharp/glib/Timeout.cs:70
Comment 1 Jeffrey Stedfast 2012-02-22 18:19:49 UTC
Ugh, sounds like the BreakpointStore was modified from another thread?
Comment 2 Jeffrey Stedfast 2012-02-22 19:15:35 UTC
Do you have a reproducible test case for this?

I think I might have a fix... I assume you were debugging when this happened?

Probably breakpoints were being resolved and thus line numbers being updated cause them to be removed and then re-added to the collection... meanwhile the editor had a queue'd UpdateBreakpoints() which fired and started iterating over the breakpoint collection to update their icons in the editor view.
Comment 3 Jeffrey Stedfast 2012-02-23 12:04:47 UTC
commit 60537596d7de0dd200b0efe92300c26aeb741a1e should solve this particular race.