[Mono-bugs] [Bug 398374] New: XmlSerializer.Deserialize() fails to parse perfectly valid XML (Works in Microsoft.NET)

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Sun Jun 8 23:38:49 EDT 2008


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


           Summary: XmlSerializer.Deserialize() fails to parse perfectly
                    valid XML (Works in Microsoft.NET)
           Product: Mono: Class Libraries
           Version: 1.9.0
          Platform: i686
        OS/Version: RHEL 4
            Status: NEW
          Severity: Critical
          Priority: P5 - None
         Component: Sys.XML
        AssignedTo: atsushi at ximian.com
        ReportedBy: andrew at ishiboo.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---


Created an attachment (id=220916)
 --> (https://bugzilla.novell.com/attachment.cgi?id=220916)
Zip containing t.cs, t.xml, DiscogsResponse.xml

Description of Problem:

When deserializing a XML document, Mono fails to properly handle an empty XML
element (i.e. "<element />") and instead thinks that it is a closing tag. This
causes the XmlReader to break on the next tag because it thinks it should be a
closing tag. (My interpretation of the error..)

Steps to reproduce the problem:
1. Save attached zip file and decompress
2. xsd DiscogsResponse.xsd /classes /namespace:Discogs
3. mcs -out:t.exe t.cs DiscogsResponse.cs
4. mono t.exe


Actual Results:

Unhandled Exception: System.Xml.XmlException: Expected >, but found s [115] 
Line 1, position 1765.
  at System.Xml.XmlTextReader.ExpectAfterWhitespace (Char c) [0x00000]
  at System.Xml.XmlTextReader.ReadEndTag () [0x00000]
  at System.Xml.XmlTextReader.ReadContent () [0x00000]
  at System.Xml.XmlTextReader.Read () [0x00000]
  at System.Xml.XmlDocument.ReadNodeCore (System.Xml.XmlReader reader)
[0x00000]
  at System.Xml.XmlDocument.ReadNodeCore (System.Xml.XmlReader reader)
[0x00000]
  at System.Xml.XmlDocument.ReadNode (System.Xml.XmlReader reader) [0x00000]
  at System.Xml.Serialization.XmlSerializationReader.ReadXmlNode (Boolean
wrapped) [0x00000]
  at System.Xml.Serialization.XmlSerializationReader.UnknownNode (System.Object
o, System.String qnames) [0x00000]
  at System.Xml.Serialization.XmlSerializationReader.UnknownNode (System.Object
o) [0x00000]
  at System.Xml.Serialization.XmlSerializationReaderInterpreter.ReadListElement
(System.Xml.Serialization.XmlTypeMapping typeMap, Boolean isNullable,
System.Object list, Boolean canCreateInstance) [0x00000]
  at System.Xml.Serialization.XmlSerializationReaderInterpreter.ReadMembers
(System.Xml.Serialization.ClassMap map, System.Object ob, Boolean isValueList,
Boolean readByOrder) [0x00000]
  at
System.Xml.Serialization.XmlSerializationReaderInterpreter.ReadClassInstanceMembers
(System.Xml.Serialization.XmlTypeMapping typeMap, System.Object ob) [0x00000]
  at
System.Xml.Serialization.XmlSerializationReaderInterpreter.ReadClassInstance
(System.Xml.Serialization.XmlTypeMapping typeMap, Boolean isNullable, Boolean
checkType) [0x00000]
  at System.Xml.Serialization.XmlSerializationReaderInterpreter.ReadObject
(System.Xml.Serialization.XmlTypeMapping typeMap, Boolean isNullable, Boolean
checkType) [0x00000]
  at
System.Xml.Serialization.XmlSerializationReaderInterpreter.ReadObjectElement
(System.Xml.Serialization.XmlTypeMapElementInfo elem) [0x00000]
  at System.Xml.Serialization.XmlSerializationReaderInterpreter.ReadMembers
(System.Xml.Serialization.ClassMap map, System.Object ob, Boolean isValueList,
Boolean readByOrder) [0x00000]
  at
System.Xml.Serialization.XmlSerializationReaderInterpreter.ReadClassInstanceMembers
(System.Xml.Serialization.XmlTypeMapping typeMap, System.Object ob) [0x00000]
  at
System.Xml.Serialization.XmlSerializationReaderInterpreter.ReadClassInstance
(System.Xml.Serialization.XmlTypeMapping typeMap, Boolean isNullable, Boolean
checkType) [0x00000]
  at System.Xml.Serialization.XmlSerializationReaderInterpreter.ReadObject
(System.Xml.Serialization.XmlTypeMapping typeMap, Boolean isNullable, Boolean
checkType) [0x00000]
  at System.Xml.Serialization.XmlSerializationReaderInterpreter.ReadRoot
(System.Xml.Serialization.XmlTypeMapping rootMap) [0x00000]
  at System.Xml.Serialization.XmlSerializationReaderInterpreter.ReadRoot ()
[0x00000]
  at System.Xml.Serialization.XmlSerializer.Deserialize
(System.Xml.Serialization.XmlSerializationReader reader) [0x00000]


Expected Results:

    The test program should run with no exception.


How often does this happen? 

    Every time.


Additional Information:

    The same XML document is parsed fine by Microsoft.NET.

$ mono -V
Mono JIT compiler version 1.9 (tarball)
Copyright (C) 2002-2007 Novell, Inc and Contributors. www.mono-project.com
        TLS:           __thread
        GC:            Included Boehm (with typed GC)
        SIGSEGV:       normal
        Notifications: epoll
        Architecture:  x86
        Disabled:      none


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