[Mono-bugs] [Bug 355975] New: System.Xml.Linq.XNodeReader incorrect behavior

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Thu Jan 24 11:53:13 EST 2008


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


           Summary: System.Xml.Linq.XNodeReader incorrect behavior
           Product: Mono: Class Libraries
           Version: 1.2.6
          Platform: i686
        OS/Version: Kubuntu
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: Sys.Core
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: avk at rsdn.ru
         QAContact: mono-bugs at lists.ximian.com
          Found By: Third Party Developer/Partner


Description of Problem:
System.Xml.Linq.XNodeReader does not work correctly

Steps to reproduce the problem:
1. Run program:
using System;
using System.IO;
using System.Xml.Linq;
using System.Xml.Serialization;

class Program
{
        static void Main(string[] args)
        {
                var rdr = new StringReader(
                        "<root><val>Value</val></root>");
                var xDoc = XDocument.Load(rdr);

                var xs = new XmlSerializer(typeof (TestClass));
                var tc = (TestClass)xs.Deserialize(xDoc.CreateReader());

                Console.WriteLine(tc.Value);
        }
}

[XmlRoot("root")]
public class TestClass
{
        [XmlElement("val")]
        public string Value {get; set; }
}

Actual Results:
Unhandled Exception: System.NullReferenceException: Object reference not set to
an instance of an object
  at XNodeReaderBug.Program.Main (System.String[] args) [0x00000]

Expected Results:
Value

How often does this happen? 
Always

Additional Information:
I use System.Xml.Linq from svn revision 93807
Depends on serialized class, an exception may occur while deserialization:
System.ArgumentOutOfRangeException : Less than 0 or more than list count.
Parameter name: index
-1
  at System.Collections.ArrayList.RemoveAt (Int32 index) [0x0004d] in
/tmp/mono/mono-1.2.6/mcs/class/corlib/System.Collections/ArrayList.cs:3014
  at System.Xml.Schema.XmlSchemaValidator.ValidateEndElement
(System.Xml.Schema.XmlSchemaInfo info, System.Object var) [0x0001a] in
/tmp/mono/mono-1.2.6/mcs/class/System.XML/System.Xml.Schema/XmlSchemaValidator.cs:449
  at System.Xml.Schema.XmlSchemaValidator.ValidateEndElement
(System.Xml.Schema.XmlSchemaInfo info) [0x00000] in
/tmp/mono/mono-1.2.6/mcs/class/System.XML/System.Xml.Schema/XmlSchemaValidator.cs:430
  at Mono.Xml.Schema.XmlSchemaValidatingReader.Read () [0x00238] in
/tmp/mono/mono-1.2.6/mcs/class/System.XML/Mono.Xml.Schema/XmlSchemaValidatingReader.cs:743
  at System.Xml.XmlDocument.ReadNodeCore (System.Xml.XmlReader reader)
[0x0035d] in
/tmp/mono/mono-1.2.6/mcs/class/System.XML/System.Xml/XmlDocument.cs:976
  at System.Xml.XmlDocument.ReadNode (System.Xml.XmlReader reader) [0x0004c] in
/tmp/mono/mono-1.2.6/mcs/class/System.XML/System.Xml/XmlDocument.cs:829
  at System.Xml.Serialization.XmlSerializationReader.ReadXmlNode (Boolean
wrapped) [0x0000e] in
/tmp/mono/mono-1.2.6/mcs/class/System.XML/System.Xml.Serialization/XmlSerializationReader.cs:794
  at System.Xml.Serialization.XmlSerializationReader.UnknownNode (System.Object
o, System.String qnames) [0x00000] in
/tmp/mono/mono-1.2.6/mcs/class/System.XML/System.Xml.Serialization/XmlSerializationReader.cs:1003
  at System.Xml.Serialization.XmlSerializationReader.UnknownNode (System.Object
o) [0x00000] in
/tmp/mono/mono-1.2.6/mcs/class/System.XML/System.Xml.Serialization/XmlSerializationReader.cs:995
  at System.Xml.Serialization.XmlSerializationReader.ReadNull () [0x00048] in
/tmp/mono/mono-1.2.6/mcs/class/System.XML/System.Xml.Serialization/XmlSerializationReader.cs:440
  at
System.Xml.Serialization.XmlSerializationReaderInterpreter.ReadClassInstance
(System.Xml.Serialization.XmlTypeMapping typeMap, Boolean isNullable, Boolean
checkType) [0x00000] in
/tmp/mono/mono-1.2.6/mcs/class/System.XML/System.Xml.Serialization/XmlSerializationReaderInterpreter.cs:205
  at System.Xml.Serialization.XmlSerializationReaderInterpreter.ReadObject
(System.Xml.Serialization.XmlTypeMapping typeMap, Boolean isNullable, Boolean
checkType) [0x00031] in
/tmp/mono/mono-1.2.6/mcs/class/System.XML/System.Xml.Serialization/XmlSerializationReaderInterpreter.cs:193
  at System.Xml.Serialization.XmlSerializationReaderInterpreter.ReadRoot
(System.Xml.Serialization.XmlTypeMapping rootMap) [0x00057] in
/tmp/mono/mono-1.2.6/mcs/class/System.XML/System.Xml.Serialization/XmlSerializationReaderInterpreter.cs:184
  at System.Xml.Serialization.XmlSerializationReaderInterpreter.ReadRoot ()
[0x00028] in
/tmp/mono/mono-1.2.6/mcs/class/System.XML/System.Xml.Serialization/XmlSerializationReaderInterpreter.cs:87
  at System.Xml.Serialization.XmlSerializer.Deserialize
(System.Xml.Serialization.XmlSerializationReader reader) [0x0001c] in
/tmp/mono/mono-1.2.6/mcs/class/System.XML/System.Xml.Serialization/XmlSerializer.cs:360


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