Bug 14965 - Exception with immediate window completion
Summary: Exception with immediate window completion
Status: RESOLVED FIXED
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: Debugger ()
Version: unspecified
Hardware: PC Mac OS
: High major
Target Milestone: master
Assignee: Jeffrey Stedfast
URL:
Depends on:
Blocks:
 
Reported: 2013-09-24 16:52 UTC by Jérémie Laval
Modified: 2014-04-29 11:38 UTC (History)
3 users (show)

Tags:
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:
Status:
RESOLVED FIXED

Description Jérémie Laval 2013-09-24 16:52:25 UTC
System.InvalidOperationException: Collection was modified; enumeration operation may not execute.
  at System.Collections.Generic.List`1+Enumerator[MonoDevelop.Ide.CodeCompletion.ListWidget+Category].MoveNext () [0x00075] in /private/tmp/source/bockbuild-xamarin/profiles/mono-mac-xamarin-no-pcl/build-root/mono-3.2.1/mcs/class/corlib/System.Collections.Generic/List.cs:799 
  at MonoDevelop.Ide.CodeCompletion.ListWidget.Iterate (Boolean startAtPage, System.Int32& ypos, MonoDevelop.Ide.CodeCompletion.CategoryAction catAction, MonoDevelop.Ide.CodeCompletion.ItemAction action) [0x00068] in /Users/builder/data/lanes/monodevelop-lion-master/ddab9a77/source/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/ListWidget.cs:758 
  at MonoDevelop.Ide.CodeCompletion.ListWidget.OnExposeEvent (Gdk.EventExpose args) [0x001e8] in /Users/builder/data/lanes/monodevelop-lion-master/ddab9a77/source/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/ListWidget.cs:451 
  at Gtk.Widget.exposeevent_cb (IntPtr widget, IntPtr evnt) [0x00000] in <filename unknown>:0
Comment 1 Jeffrey Stedfast 2013-09-30 12:58:59 UTC
Mike: any idea what I might be doing wrong?
Comment 2 Jeffrey Stedfast 2013-12-05 15:35:04 UTC
do you recall how to reproduce this?
Comment 3 Mike Krüger 2013-12-06 00:47:29 UTC
Maybe it's a threading issue - categories got changed during an expose.
Comment 4 Alan McGovern 2014-04-28 18:58:10 UTC
I'm still hitting this reasonably frequently, as is Jeremie. We're just going to put a try/catch in. If someone has the time for a proper fix, please do!
Comment 5 Alan McGovern 2014-04-29 00:02:34 UTC
I added some debugging printfs and found the issue. While we're in the OnExpose 'Iterate' loop we call "win.ResetSizes ();". This can result in 'FilterWords' being called which is what is changing the categories collection while we are iterating it.

I presume the simple fix would be to make sure we don't change the completion string while we are in the middle of the OnExpose event?

Here is the stacktrace causing the issue. I can typically trigger it in certain cases by enabling category mode and then pressing 't'. The only item in the list at the time is 'token':

at System.Environment.get_StackTrace() in /Volumes/build-root-ramdisk/mono-3.4.0/mcs/class/corlib/System/Environment.cs:line 261
   at MonoDevelop.Ide.CodeCompletion.ListWidget.FilterWords() in /Users/alan/Projects/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/ListWidget.cs:line 664
   at MonoDevelop.Ide.CodeCompletion.ListWidget.set_CompletionString(System.String value) in /Users/alan/Projects/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/ListWidget.cs:line 84
   at MonoDevelop.Ide.CodeCompletion.ListWindow.ResetSizes() in /Users/alan/Projects/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/ListWindow.cs:line 143
   at MonoDevelop.Ide.CodeCompletion.ListWidget+<OnExposeEvent>c__AnonStorey2.<>m__1(MonoDevelop.Ide.CodeCompletion.Category curCategory, Int32 item, Int32 itemidx, Int32 ypos) in /Users/alan/Projects/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/ListWidget.cs:line 589
   at MonoDevelop.Ide.CodeCompletion.ListWidget.IterateItems(MonoDevelop.Ide.CodeCompletion.Category category, Boolean startAtPage, Int32 ByRef ypos, Int32 ByRef curItem, MonoDevelop.Ide.CodeCompletion.ItemAction action) in /Users/alan/Projects/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/ListWidget.cs:line 809
   at MonoDevelop.Ide.CodeCompletion.ListWidget.Iterate(Boolean startAtPage, Int32 ByRef ypos, MonoDevelop.Ide.CodeCompletion.CategoryAction catAction, MonoDevelop.Ide.CodeCompletion.ItemAction action) in /Users/alan/Projects/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/ListWidget.cs:line 779
   at MonoDevelop.Ide.CodeCompletion.ListWidget.OnExposeEvent(Gdk.EventExpose args) in /Users/alan/Projects/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/ListWidget.cs:line 455
   at Gtk.Widget.exposeevent_cb(IntPtr widget, IntPtr evnt) in /Volumes/build-root-ramdisk/gtk-sharp-2.12.21/gtk/generated/Widget.cs:line 1979
   at Gtk.Application.gtk_main()
   at Gtk.Application.Run() in /Volumes/build-root-ramdisk/gtk-sharp-2.12.21/gtk/Application.cs:line 135
   at MonoDevelop.Ide.IdeApp.Run() in /Users/alan/Projects/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/Ide.cs:line 385
   at MonoDevelop.Ide.IdeStartup.Run(MonoDevelop.Ide.MonoDevelopOptions options) in /Users/alan/Projects/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/IdeStartup.cs:line 299
   at MonoDevelop.Ide.IdeStartup.Main(System.String[] args, MonoDevelop.Ide.Extensions.IdeCustomizer customizer) in /Users/alan/Projects/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/IdeStartup.cs:line 615
   at MonoDevelop.Startup.MonoDevelopMain.Main(System.String[] args) in /Users/alan/Projects/monodevelop/main/src/core/MonoDevelop.Startup/MonoDevelop.Startup/MonoDevelopMain.cs:line 39
Comment 6 Mike Krüger 2014-04-29 01:09:59 UTC
I think it should now be fixed. The categories are no longer changed.

(commit 7e1cfa4e3256cbe43e4bb5ac22b22c7d9bbcccfc)

@alan: Can you test/verify it ?
Comment 7 Alan McGovern 2014-04-29 11:38:04 UTC
It looks like it's fixed alright. Thanks!