[Mono-bugs] [Bug 548496] New: BindingSource throws exception when inserting objects of different types

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Tue Oct 20 13:43:43 EDT 2009


http://bugzilla.novell.com/show_bug.cgi?id=548496


           Summary: BindingSource throws exception when inserting objects
                    of different types
    Classification: Mono
           Product: Mono: Class Libraries
           Version: 2.4.x
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: Windows.Forms
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: mark.davis at rbza.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: Development


Description of Problem:

BindingSource does not allow objects of various types to be inserted into the
list.  This is an unnecessary limitation and is not consistent with .NET
behavior.

Steps to reproduce the problem:
1. Create a BindingSource and set its DataSource property to some arbitrary
list.  Objects in the list do not have to be of the same type.

2. Call BindingSource.Insert or BindingSource.Add with an object of a type that
is different than the first object in the bound list.


Actual Results:

BindingSource.Insert or BindingSource.Add will throw an exception.

Expected Results:

BindingSource.Insert or BindingSource.Add should insert the new object into the
list.

How often does this happen? 

Always.

Additional Information:

Excerpts from BindingSource.cs type perform type check:

641  if (value != null && !item_type.IsAssignableFrom (value.GetType ()))
642      throw new InvalidOperationException ("Objects added to the list must
all be of the same type.");


668  if (new_object != null) {
669      if (!item_type.IsAssignableFrom (new_object.GetType ()))
670          throw new InvalidOperationException ("Objects added to the list
must all be of the same type.");


810  if (!item_type.IsAssignableFrom (value.GetType ()))
811      throw new ArgumentException ("value");

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