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


           Summary: Exception Thrown with ListBox.RemoveAt()
    Classification: Mono
           Product: Mono: Class Libraries
           Version: 2.0.x
          Platform: x86-64
        OS/Version: openSUSE 11.0
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: Windows.Forms
        AssignedTo: [email protected]
        ReportedBy: [email protected]
         QAContact: [email protected]
          Found By: Customer


ListBox.Items.RemoveAt(0) throws Exception:

System.ArgumentOutOfRangeException: Argument is out of range.
Parameter name: GetItemRectangle index out of range.
  at System.Windows.Forms.ListBox.GetItemRectangle (Int32 index) [0x00167] in
/usr/src/packages/BUILD/mono-2.0.1/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListBox.cs:847
 
  at System.Windows.Forms.ListBox.GetItemDisplayRectangle (Int32 index, Int32
first_displayble) [0x00008] in
/usr/src/packages/BUILD/mono-2.0.1/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListBox.cs:1286
 
  at System.Windows.Forms.ListBox.InvalidateItem (Int32 index) [0x0000c] in
/usr/src/packages/BUILD/mono-2.0.1/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListBox.cs:1687
 
  at (wrapper remoting-invoke-with-check)
System.Windows.Forms.ListBox:InvalidateItem (int)
  at System.Windows.Forms.ListBox+SelectedIndexCollection.ClearCore ()
[0x00030] in
/usr/src/packages/BUILD/mono-2.0.1/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListBox.cs:2699
 
  at System.Windows.Forms.ListBox+SelectedIndexCollection.Clear () [0x00000] in
/usr/src/packages/BUILD/mono-2.0.1/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListBox.cs:2687
 
  at System.Windows.Forms.ListBox.ClearSelected () [0x00000] in
/usr/src/packages/BUILD/mono-2.0.1/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListBox.cs:716
 
  at (wrapper remoting-invoke-with-check)
System.Windows.Forms.ListBox:ClearSelected ()


Code snippet:
private void Status(string msg)
{
  if (ListBox1.Items.Count > 7)
    ListBox1.Items.RemoveAt(0);  // <<= Throws exception here

  List.ClearSelected();
  int index = ListBox1.Items.Add(msg);
  ListBox1.SelectedIndex = index;
}

Steps to reproduce the problem:
1. Add several items to ListBox 
2. Try to remove 1st item with ListBox1.Items.RemoveAt(0);


Actual Results:  Throws above exception (index out of bounds)


Expected Results: Should remove first item.


How often does this happen? Every time


Additional Information: Mono v2.0.1-18.1-i586

-- 
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.
_______________________________________________
mono-bugs maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-bugs

Reply via email to