[Mono-bugs] [Bug 507120] GetListItemType throws NullReferenceException when dataSource's type is DataViewManager

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Sat Jun 6 08:28:11 EDT 2009


User calberto.cortez at gmail.com added comment

Carlos Alberto Cortez <calberto.cortez at gmail.com> changed:

           What    |Removed                     |Added
                 CC|                            |calberto.cortez at gmail.com

--- Comment #1 from Carlos Alberto Cortez <calberto.cortez at gmail.com>  2009-06-06 06:28:07 MDT ---
The fix for (1) was applied in rev 135593:

2009-06-06  Carlos Alberto Cortez <calberto.cortez at gmail.com>

        * ListBindingHelper.cs: In GetListItemType handle gracefully the case
        where an instance of IEnumerator returns a null value for its Current
        property. Fix by Florent Fayolle (p.ricca at odyssee-ingenierie.com).
        Fixes #507120.

Regarding this one:

    if (dataSource is IList || dataSource.GetType () == typeof (IList<>)) {
        PropertyInfo property = GetPropertyByReflection (dataSource.GetType (),
        if (property != null)
            return property.PropertyType;

There's no need to use it at all, since before trying to load the "Item"
property we have already checked the class implements IList/IList<T> which *do*
implement this property. We just get the type information from that property,
and we are not actually using/calling it, so it doesn't matter if the
collection is empty or has a null element.

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