[Mono-bugs] [Bug 373971] New: ArgumentOutOfRangeException after binding ListBox to an empty BindingList

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Wed Mar 26 10:12:26 EDT 2008


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


           Summary: ArgumentOutOfRangeException after binding ListBox to an
                    empty BindingList
           Product: Mono: Class Libraries
           Version: 1.2.6
          Platform: i586
        OS/Version: Ubuntu
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: Windows.Forms
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: richard.foster at quixotetraffic.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---


If a ListBox is bound to an object implementing IBingingList which at the time
of binding is empty, then adding items to the list causes an
ArgumentOutOfRangeException.

In the Microsoft implementation, no error is observed, and the newly added item
appears (as expected) in the ListBox.

To reproduce:

1) Create a Windows Forms project.
2) On an otherwise blank form, add a ListBox. (I accepted the default Visual
Studio name of listBox1.)
3) Add a button, and place the following code into the button's event handler:

BindingList<KeyValuePair<int, string>> items = new
BindingList<KeyValuePair<int, string>>();

this.listBox1.DataSource = items;
this.listBox1.DisplayMember = "Value";

items.Add(new KeyValuePair<int, string>(1,"Item"));

4) Build the project, and launch it. The form should appear, but when the
button is pressed the exception will be generated.

I believe (Running Mono 1.9.0 beta under Windows XP) that the same problem is
still present in 1.9 beta.


-- 
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