[Mono-bugs] [Bug 601290] New: System.Web.UI.CollectionBuilder error parsing collections with multiple indexers

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Fri Apr 30 05:30:59 EDT 2010



           Summary: System.Web.UI.CollectionBuilder error parsing
                    collections with multiple indexers
    Classification: Mono
           Product: Mono: Class Libraries
           Version: 2.6.x
          Platform: x86-64
        OS/Version: Linux
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: Sys.Web
        AssignedTo: mhabersack at novell.com
        ReportedBy: Kalyanov.Dmitry at gmail.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---
           Blocker: ---

Created an attachment (id=358100)
 --> (http://bugzilla.novell.com/attachment.cgi?id=358100)
Monodevelop project demonstrating the error

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 6.1; ru; rv:
Gecko/20100401 Firefox/3.6.3

CollectionBuilder uses the type of the first indexer property of a collection
to determine the possible types of colleciton children. But if some class has
multiple indexers this may go wrong.

E.g. this happens with Coolite (now Ext.Net) ParameterCollection property
(http://www.coolite.com/forums/Topic26939-7-1.aspx): the ParameterCollection
implements IList<Parameter> (which has property `Parameter this[int index]')
and also has property `string this[int name]' (which gets the parameter value
by name). CollectionBuilder sees the `string this[int name]' property and will
not allow adding `Parameter' objects to the collection with the following

Parser Error Message: Cannot add a Coolite.Ext.Web.Parameter to System.String

Attached is a small test case that displays the behaviour. In this example,
when viewed from a browser the following message is displayed:

"Cannot add a mono_asp_collection_builder.TestControl to System.String"

I've attached a patch that changes the behaviour to look for all indexer
properties instead of just the first. 
I'm not sure what is the correct behaviour of CollectionBuilder, but current
behavior differs from ASP.NET.

Reproducible: Always

Steps to Reproduce:
1. run2 xsp in mono_asp_collection_builder
2. open http://localhost:8080/ in browser
Actual Results:  
Error page is displayed with the message "Cannot add a
mono_asp_collection_builder.TestControl to System.String"

Expected Results:  
It is expected that the page with a button and text "1 subcontrols" is

Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.

More information about the mono-bugs mailing list