[Mono-bugs] [Bug 352195] New: Adding a TabPage from one TabControl to another inside a foreach crashes

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Mon Jan 7 19:23:26 EST 2008


https://bugzilla.novell.com/show_bug.cgi?id=352195


           Summary: Adding a TabPage from one TabControl to another inside a
                    foreach crashes
           Product: Mono: Class Libraries
           Version: unspecified
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: Windows.Forms
        AssignedTo: mono-bugs at ximian.com
        ReportedBy: avidigal at novell.com
         QAContact: mono-bugs at ximian.com
          Found By: ---


Looping the TabPages collection and adding each tabpage to another tabcontrol
crashes with the following stacktrace. Test code is below.

============================================

Unhandled Exception: System.InvalidOperationException: List has changed.
  at System.Collections.ArrayList+SimpleEnumerator.MoveNext () [0x00068] in
/mono/mono/mcs/class/corlib/System.Collections/ArrayList.cs:142 
  at tests.form.OnLoad (System.EventArgs e) [0x00000] 
  at System.Windows.Forms.Form.OnLoadInternal (System.EventArgs e) [0x00023] in
/mono/mono/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Form.cs:2884 
  at System.Windows.Forms.Form.OnCreateControl () [0x00027] in
/mono/mono/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Form.cs:2018 
  at System.Windows.Forms.Control.CreateControl () [0x0009e] in
/mono/mono/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs:3610 
  at System.Windows.Forms.Control.WmShowWindow (System.Windows.Forms.Message&
m) [0x00036] in
/mono/mono/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs:5451 
  at System.Windows.Forms.Control.WndProc (System.Windows.Forms.Message& m)
[0x001dc] in
/mono/mono/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs:5084 
  at System.Windows.Forms.ScrollableControl.WndProc
(System.Windows.Forms.Message& m) [0x00000] in
/mono/mono/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ScrollableControl.cs:717 
  at System.Windows.Forms.ContainerControl.WndProc
(System.Windows.Forms.Message& m) [0x0003d] in
/mono/mono/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ContainerControl.cs:560 
  at System.Windows.Forms.Form.WndProc (System.Windows.Forms.Message& m)
[0x0017c] in
/mono/mono/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Form.cs:2484 
  at System.Windows.Forms.Control+ControlWindowTarget.OnMessage
(System.Windows.Forms.Message& m) [0x00000] in
/mono/mono/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs:225 
  at System.Windows.Forms.Control+ControlNativeWindow.WndProc
(System.Windows.Forms.Message& m) [0x00000] in
/mono/mono/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs:206 
  at System.Windows.Forms.NativeWindow.WndProc (IntPtr hWnd, Msg msg, IntPtr
wParam, IntPtr lParam) [0x0006a] in
/mono/mono/mcs/class/Managed.Windows.Forms/System.Windows.Forms/NativeWindow.cs:188 
  at System.Windows.Forms.XplatUIX11.SendMessage (IntPtr hwnd, Msg message,
IntPtr wParam, IntPtr lParam) [0x0008d] in
/mono/mono/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIX11.cs:4883 
  at System.Windows.Forms.XplatUIX11.MapWindow (System.Windows.Forms.Hwnd hwnd,
WindowType windows) [0x0003c] in
/mono/mono/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIX11.cs:1435 
  at System.Windows.Forms.XplatUIX11.CreateWindow
(System.Windows.Forms.CreateParams cp) [0x00569] in
/mono/mono/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIX11.cs:2711 
  at System.Windows.Forms.XplatUI.CreateWindow
(System.Windows.Forms.CreateParams cp) [0x00000] in
/mono/mono/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUI.cs:450 
  at System.Windows.Forms.NativeWindow.CreateHandle
(System.Windows.Forms.CreateParams create_params) [0x0000c] in
/mono/mono/mcs/class/Managed.Windows.Forms/System.Windows.Forms/NativeWindow.cs:112 
  at System.Windows.Forms.Control.CreateHandle () [0x0003f] in
/mono/mono/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs:4239 
  at System.Windows.Forms.Form.CreateHandle () [0x00000] in
/mono/mono/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Form.cs:1911 
  at System.Windows.Forms.Control.CreateControl () [0x00044] in
/mono/mono/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs:3590 
  at System.Windows.Forms.Control.SetVisibleCore (Boolean value) [0x0003e] in
/mono/mono/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs:4787 
  at System.Windows.Forms.Form.SetVisibleCore (Boolean value) [0x00071] in
/mono/mono/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Form.cs:2334 
  at System.Windows.Forms.Control.set_Visible (Boolean value) [0x0000c] in
/mono/mono/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs:3262 
  at (wrapper remoting-invoke-with-check)
System.Windows.Forms.Control:set_Visible (bool)
  at System.Windows.Forms.Application.RunLoop (Boolean Modal,
System.Windows.Forms.ApplicationContext context) [0x00059] in
/mono/mono/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Application.cs:736 
  at System.Windows.Forms.Application.Run
(System.Windows.Forms.ApplicationContext context) [0x00014] in
/mono/mono/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Application.cs:635 
  at System.Windows.Forms.Application.Run (System.Windows.Forms.Form mainForm)
[0x00000] in
/mono/mono/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Application.cs:623 


============================================

using System;
using System.Drawing;
using System.Windows.Forms;

namespace tests {
  public class form : Form {

    public static void Main () {
      Application.Run (new form ());
    }


    TabControl tabcontrol;
    TabControl tabcontrol2;

    public form () {
      tabcontrol = new TabControl ();
      tabcontrol2 = new TabControl ();

      tabcontrol.Location = new Point (0, 0);
      tabcontrol2.Location = new Point (0, 100);

      TabPage p = new TabPage ();
      tabcontrol.TabPages.Add (p);
      p = new TabPage ();
      tabcontrol.TabPages.Add (p);

      this.Controls.Add (tabcontrol);
      this.Controls.Add (tabcontrol2);
    }

    protected override void OnLoad (EventArgs e) {
      for (int i = 0; i < tabcontrol.TabPages.Count; i++) {
        TabPage page = tabcontrol.TabPages[i];
        tabcontrol2.TabPages.Add (page);
      }
    }
  }
}


-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the mono-bugs mailing list