Bug 55922 - TabControl crash on selected tab
Summary: TabControl crash on selected tab
Status: NEW
Alias: None
Product: Class Libraries
Classification: Mono
Component: Windows.Forms ()
Version: 4.8.0 (C9)
Hardware: PC Linux
: --- normal
Target Milestone: Community
Assignee: Bugzilla
Depends on:
Reported: 2017-05-03 16:01 UTC by James Bellinger
Modified: 2017-09-01 11:56 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 for Bug 55922 on GitHub or Developer Community if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: GitHub Markdown or Developer Community HTML
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:

Description James Bellinger 2017-05-03 16:01:50 UTC

I am running Mono 4.8.1 according to mono --version.

I have a program which uses the Windows Forms TabControl, and removes all tabs (and later, after this crash, adds new tabs in). So in this program there will be zero tabs for a time.

Mono crashes when this happens:

System.ArgumentOutOfRangeException: ControlCollection does not have that many controls
Parameter name: index
Actual value was 0.
  at System.Windows.Forms.Control+ControlCollection.get_Item (System.Int32 index) [0x0002d] in <b4e6df1a5a1f4b78af726adaf5fd3ede>:0 
  at System.Windows.Forms.TabControl.GetTab (System.Int32 index) [0x00006] in <b4e6df1a5a1f4b78af726adaf5fd3ede>:0 
  at (wrapper remoting-invoke-with-check) System.Windows.Forms.TabControl:GetTab (int)
  at System.Windows.Forms.TabControl+TabPageCollection.get_Item (System.Int32 index) [0x00000] in <b4e6df1a5a1f4b78af726adaf5fd3ede>:0 
  at System.Windows.Forms.TabControl.get_SelectedTab () [0x0000e] in <b4e6df1a5a1f4b78af726adaf5fd3ede>:0 
  at System.Windows.Forms.TabControl.OnLeave (System.EventArgs e) [0x00000] in <b4e6df1a5a1f4b78af726adaf5fd3ede>:0 
  at System.Windows.Forms.Control.FireLeave () [0x00000] in <b4e6df1a5a1f4b78af726adaf5fd3ede>:0 
  at System.Windows.Forms.ContainerControl.set_ActiveControl (System.Windows.Forms.Control value) [0x00093] in <b4e6df1a5a1f4b78af726adaf5fd3ede>:0 
  at System.Windows.Forms.Control.Select (System.Boolean directed, System.Boolean forward) [0x00019] in <b4e6df1a5a1f4b78af726adaf5fd3ede>:0 
  at System.Windows.Forms.Control.SelectNextControl (System.Windows.Forms.Control ctl, System.Boolean forward, System.Boolean tabStopOnly, System.Boolean nested, System.Boolean wrap) [0x00076] in <b4e6df1a5a1f4b78af726adaf5fd3ede>:0 
  at System.Windows.Forms.ContainerControl.ChildControlRemoved (System.Windows.Forms.Control control) [0x00054] in <b4e6df1a5a1f4b78af726adaf5fd3ede>:0 
  at (wrapper remoting-invoke-with-check) System.Windows.Forms.ContainerControl:ChildControlRemoved (System.Windows.Forms.Control)
  at System.Windows.Forms.Control+ControlCollection.Remove (System.Windows.Forms.Control value) [0x0005f] in <b4e6df1a5a1f4b78af726adaf5fd3ede>:0 
  at System.Windows.Forms.TabControl+ControlCollection.Remove (System.Windows.Forms.Control value) [0x0005d] in <b4e6df1a5a1f4b78af726adaf5fd3ede>:0 
  at System.Windows.Forms.Control+ControlCollection.RemoveAt (System.Int32 index) [0x0003b] in <b4e6df1a5a1f4b78af726adaf5fd3ede>:0 
  at i.SO`1[Sb].S (System.Int32 ) [0x00014] in <26d09d6e5cfb48b6a88135d373f2b01e>:0 
  at K.Eg.UM (K.EE , K.EE ) [0x0005e] in <99b16100d05e4f26bb62c4ad304a464c>:0 
  at y.mn.ix () [0x000af] in <a7d5a053e4834e85a5b4b766894cf701>:0 
  at y.mn.O (System.Boolean , B.oG , System.String , System.String ) [0x003e2] in <a7d5a053e4834e85a5b4b766894cf701>:0 
  at M.TA+UT.F (System.Boolean ) [0x001b6] in <6b4443158a024fcf9b994d56c41f6abc>:0 
  at M.TA+UT.R (System.Object , System.EventArgs ) [0x00000] in <6b4443158a024fcf9b994d56c41f6abc>:0 
  at B.qM.CC () [0x00044] in <b4f8171dbfdd43eebe6041519d68b70c>:0 
  at B.qM.H (B.qM ) [0x000f9] in <b4f8171dbfdd43eebe6041519d68b70c>:0 
  at y.VG.ee (B.qM ) [0x00011] in <a7d5a053e4834e85a5b4b766894cf701>:0 
  at M.fh+XGX`1[XGj].T (System.Object , XGj ) [0x00000] in <0ca40a7f00224e679d85a10327d7dbc6>:0 
  at M.fh+XFC`2[XFZ,XGL].Qm () [0x00017] in <0ca40a7f00224e679d85a10327d7dbc6>:0 
  at K.vM.JR (System.Action , System.Action ) [0x0007e] in <99b16100d05e4f26bb62c4ad304a464c>:0 
  at M.fh.p[i,n] (M.fC , i , n , System.Func`2[T,TResult] , System.Action`2[T1,T2] ) [0x000be] in <0ca40a7f00224e679d85a10327d7dbc6>:0 
  at M.fh.h[V] (M.fC , V , System.Func`1[TResult] , System.Action`1[T] ) [0x0002f] in <0ca40a7f00224e679d85a10327d7dbc6>:0 
  at y.VG.x (B.qM , System.Boolean ) [0x00025] in <a7d5a053e4834e85a5b4b766894cf701>:0 
  at y.xy.x (System.Boolean , B.oG ) [0x0014d] in <a7d5a053e4834e85a5b4b766894cf701>:0 
  at y.DV.x (B.oG ) [0x00000] in <a7d5a053e4834e85a5b4b766894cf701>:0 
  at y.DV.mm (B.oG ) [0x00000] in <a7d5a053e4834e85a5b4b766894cf701>:0 
  at y.xl+ZB`1[ZV].r (System.Object , System.EventArgs ) [0x00000] in <a7d5a053e4834e85a5b4b766894cf701>:0 
  at i.xg.I (System.Object , System.Windows.Forms.LinkLabelLinkClickedEventArgs ) [0x00040] in <26d09d6e5cfb48b6a88135d373f2b01e>:0 
  at System.Windows.Forms.LinkLabel.OnLinkClicked (System.Windows.Forms.LinkLabelLinkClickedEventArgs e) [0x0001c] in <b4e6df1a5a1f4b78af726adaf5fd3ede>:0 
  at System.Windows.Forms.LinkLabel.OnMouseUp (System.Windows.Forms.MouseEventArgs e) [0x0006f] in <b4e6df1a5a1f4b78af726adaf5fd3ede>:0 
  at System.Windows.Forms.Control.WmLButtonUp (System.Windows.Forms.Message& m) [0x0007e] in <b4e6df1a5a1f4b78af726adaf5fd3ede>:0 
  at System.Windows.Forms.Control.WndProc (System.Windows.Forms.Message& m) [0x0016f] in <b4e6df1a5a1f4b78af726adaf5fd3ede>:0 
  at System.Windows.Forms.Label.WndProc (System.Windows.Forms.Message& m) [0x00025] in <b4e6df1a5a1f4b78af726adaf5fd3ede>:0 
  at System.Windows.Forms.LinkLabel.WndProc (System.Windows.Forms.Message& msg) [0x00000] in <b4e6df1a5a1f4b78af726adaf5fd3ede>:0 
  at System.Windows.Forms.Control+ControlWindowTarget.OnMessage (System.Windows.Forms.Message& m) [0x00000] in <b4e6df1a5a1f4b78af726adaf5fd3ede>:0 
  at System.Windows.Forms.Control+ControlNativeWindow.WndProc (System.Windows.Forms.Message& m) [0x0000b] in <b4e6df1a5a1f4b78af726adaf5fd3ede>:0 
  at System.Windows.Forms.NativeWindow.WndProc (System.IntPtr hWnd, System.Windows.Forms.Msg msg, System.IntPtr wParam, System.IntPtr lParam) [0x0008e] in <b4e6df1a5a1f4b78af726adaf5fd3ede>:0