[Mono-bugs] [Bug 76621][Wis] New - add menu after form running
cause crash
bugzilla-daemon at bugzilla.ximian.com
bugzilla-daemon at bugzilla.ximian.com
Wed Nov 2 18:06:49 EST 2005
Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.
Changed by marines_one at tiscali.fr.
http://bugzilla.ximian.com/show_bug.cgi?id=76621
--- shadow/76621 2005-11-02 18:06:49.000000000 -0500
+++ shadow/76621.tmp.23745 2005-11-02 18:06:49.000000000 -0500
@@ -0,0 +1,94 @@
+Bug#: 76621
+Product: Mono: Class Libraries
+Version: 1.1
+OS:
+OS Details: Gentoo
+Status: NEW
+Resolution:
+Severity:
+Priority: Wishlist
+Component: Windows.Forms
+AssignedTo: peter at novonyx.com
+ReportedBy: marines_one at tiscali.fr
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: add menu after form running cause crash
+
+Please fill in this template when reporting a bug, unless you know what you
+are doing.
+Description of Problem:
+When you add a MenuItem in MenuItems collection of a MenuItem after showing
+form, you have this exception :
+
+Unhandled Exception: System.ArgumentOutOfRangeException: Index is less than
+0 or
+ more than or equal to the list count.
+Parameter name: index
+-1
+in <0x00096> System.Collections.ArrayList:get_Item (Int32 index)
+in <0x00020> System.Windows.Forms.MenuAPI:GetMenuFromID (IntPtr ptr)
+in <0x0007e> System.Windows.Forms.MenuAPI:HideSubPopups (IntPtr hMenu)
+in <0x000be> System.Windows.Forms.MenuAPI:MenuBarMove (IntPtr hMenu,
+System.Wind
+ows.Forms.MENUITEM item, System.Windows.Forms.TRACKER tracker)
+...
+
+
+Steps to reproduce the problem:
+1. use this class :
+
+public class MainForm : System.Windows.Forms.Form
+ {
+
+ private MainMenu mainMenu1;
+ private MenuItem menuItem1;
+ private MenuItem menuItem2;
+ private MenuItem menuItem3;
+ private MenuItem menuItem4;
+
+ public MainForm()
+ {
+ mainMenu1 = new MainMenu();
+ this.menuItem1 = new MenuItem("Fichier");
+ this.menuItem2 = new MenuItem("Quitter1");
+ this.menuItem3 = new MenuItem("Quitter2");
+ this.menuItem4 = new MenuItem("Quitter3");
+
+
+ this.menuItem3.Click += new
+System.EventHandler(this.MenuItem3Click);
+ this.menuItem1.MenuItems.Add(this.menuItem3);
+
+ mainMenu1.MenuItems.Add(this.menuItem1);
+ mainMenu1.MenuItems.Add(this.menuItem2);
+
+ this.Menu = this.mainMenu1;
+
+ }
+
+ private void MenuItem3Click(object o, System.EventArgs e)
+ {
+ this.menuItem2.MenuItems.Add(this.menuItem4);
+ }
+
+
+ }
+
+2. Add main method and compil
+3. Click under fichier->Quitter2 and click under Quitter1
+
+Actual Results:
+ Unhandled Exception: System.ArgumentOutOfRangeException: Index is less
+than 0 or
+ more than or equal to the list count.
+Parameter name: index
+-1
+in <0x00096> System.Collections.ArrayList:get_Item (Int32 index)
+in <0x00020> System.Windows.Forms.MenuAPI:GetMenuFromID (IntPtr ptr)
+in <0x0007e> System.Windows.Forms.MenuAPI:HideSubPopups (IntPtr hMenu)
+in <0x000be> System.Windows.Forms.MenuAPI:MenuBarMove (IntPtr hMenu,
+System.Wind
+ows.Forms.MENUITEM item, System.Windows.Forms.TRACKER tracker)
+...
More information about the mono-bugs
mailing list