[Mono-bugs] [Bug 534452] New: TabControl exception when removing tab pages

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Wed Aug 26 10:57:09 EDT 2009


           Summary: TabControl exception when removing tab pages
    Classification: Mono
           Product: Mono: Class Libraries
           Version: 2.4.x
          Platform: x86
        OS/Version: All
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: Windows.Forms
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: jxelam at gmail.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---

Description of Problem:

Exception is thrown when a tab page is removed from a tab control when the
SelectedIndex of the tab control matches the number of tabs before the removal.

Steps to reproduce the problem:
1. Compile and run the below program (-R:System.Windows.Forms)

Minimalistic test app (quick and hacky to just demonstrate the issue)

using System;
using System.IO;
using System.Windows.Forms;

class TabControlFail {
    static void Main(string[] args) {
        Application.Run(new FailForm());

    public class FailForm : Form {
        private TabControl tab;
        private TabPage page;

        public FailForm() {
            tab  = new TabControl();
            page = new TabPage();

            tab.TabPages.Add(new TabPage());
            tab.TabPages.Add(new TabPage());

            tab.SelectedIndex = 2;

            Visible = false;
            Activated += new System.EventHandler(delTabs);

        private void delTabs(object sender, EventArgs e) {

Actual Results:

System.ArgumentOutOfRangeException: ControlCollection does not have that many
Parameter name: index
at System.Windows.Forms.Control+ControlCollection.get_Item (Int32 index) [0x00

Expected Results:

Tab to be removed without error

How often does this happen? 

Every time

Configure bugmail: http://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