[Mono-bugs] [Bug 708178] New: Type check invalid and breaks XmlSerialization if serializing ICollection<> types

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Mon Jul 25 17:18:11 EDT 2011



           Summary: Type check invalid  and breaks XmlSerialization if
                    serializing ICollection<> types
    Classification: Mono
           Product: Mono: Class Libraries
           Version: SVN
          Platform: x86
        OS/Version: RHEL 5
            Status: NEW
          Severity: Major
          Priority: P5 - None
         Component: Sys.XML
        AssignedTo: atsushi at ximian.com
        ReportedBy: srfcanada at hotmail.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---
           Blocker: ---

User-Agent:       Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.2; WOW64;
Trident/4.0; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; MS-RTC LM 8; .NET4.0C;
NET4.0E; .NET CLR 3.5.30729)

This was broken in https://bugzilla.novell.com/show_bug.cgi?id=704813 since it
was verifying that the passed in type has an Add method if it implements
IEnumerable<> . This is actually checking to see if the passed in type IS
IEnumerable but it should actually check to see if the passed in type should
implement IEnumerable<> since if you pass in ICollection<> (the bug mentioned
to check if the passed in type Implements IEnumerable<> and not actually
IEnumerable<>), it does implement Add but its not of type IEnumerable. 
For us, this breaks all our XmlSerialization since we serialize ICollection<>

This patch actually fixes it:
line 454:
from: if (type.IsGenericType && type.GetGenericTypeDefinition () == typeof
(IEnumerable<>)) {
to:             if (type.IsGenericType &&
typeof(IEnumerable).IsAssignableFrom(type.GetGenericTypeDefinition ())) {

Reproducible: Always

Steps to Reproduce:

Configure bugmail: https://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