[Mono-bugs] [Bug 707434] New: XmlSerializer Order attribute check is checking for this on XmlAttribute

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Thu Jul 21 12:25:33 EDT 2011


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

https://bugzilla.novell.com/show_bug.cgi?id=707434#c0


           Summary: XmlSerializer Order attribute check is checking for
                    this on XmlAttribute
    Classification: Mono
           Product: Mono: Class Libraries
           Version: SVN
          Platform: 64bit
        OS/Version: RHEL 5
            Status: NEW
          Severity: Normal
          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)

Related to patch
https://github.com/mono/mono/commit/4fab2dc4c31a1161a90deb3003106bf3b81fab44

in the XmlReflectionImporter.cs in method its looking for Order in the
XmlAttribute type. The Call to GetReflectionMembers should only be looking at
Xml Elements. 

modifying the test given in the patch by added a property with an XMLAttribute
field will generate this error. It would also be nice in the error to give the
type and member name that is the problem since if they actaully do have this
problem then it will help them track down what member is missing the order
attribute field.

this test will fail regaring the XmlAttribute on child3 but Order isnt a valid
option for XmlAttribute:

using System;
using System.Reflection;
using System.Collections.Generic;
using System.Xml.Serialization;
using System.IO;

namespace fail10
{
   class MainClass
   {
      public static void Main (string[] args)
      {
    var xs = new XmlSerializer (typeof (ExplicitlyOrderedMembersType3)); 
    var result = (ExplicitlyOrderedMembersType3) xs.Deserialize(new
StringReader (@" 
    <root> 
    <child>Hello</child> 
    <child>World</child> 
    <child0>test</child0> 
    </root>")); 
      }
   }

    [XmlRoot("root")] 
    public class ExplicitlyOrderedMembersType3 
    { 
    [XmlElement("child0", Order = 1)] // it's between 0 and 2. After two
"child" elements, child0 is not recognized as this member. 
    public string Child0; 

    [XmlElement("child", Order = 0)] 
    public string Child1; 

    [XmlElement("child", Order = 2)] 
    public string Child2; 

    [XmlAttribute]
    public string Child3; 
    } 

} 

Reproducible: Always

Steps to Reproduce:
1.
2.
3.

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