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

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Sat Jan 26 10:50:21 EST 2008


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

User avk at rsdn.ru added comment
https://bugzilla.novell.com/show_bug.cgi?id=356522#c355975

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


Similar to Bug #355975

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

Steps to reproduce the problem:
1. Run program (same as in bug #355975, but non-default namespace added):
using System;
using System.IO;
using System.Xml.Linq;
using System.Xml.Serialization;

namespace XNodeReaderBug
{
        class Program
        {
                static void Main(string[] args)
                {               
                        var rdr = new StringReader(
                                "<root
xmlns='XNodeReaderTest.xsd'>Value</root>");
                        var xDoc = XDocument.Load(rdr);
                        var reader = xDoc.CreateReader();

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

                        Console.WriteLine(tc.Value);
                }
        }

        [XmlRoot("root", Namespace = "XNodeReaderTest.xsd")]
        public class TestClass
        {
                [XmlText]
                public string Value {get; set; }
        }
}

Actual Results:
Unhandled Exception: System.NullReferenceException: Object reference not set to
an instance of an object
  at System.Xml.Linq.XNodeReader.GetName (Int32 attr, Boolean attr_value)
[0x00000]
  at System.Xml.Linq.XNodeReader.MoveToAttribute (System.String local,
System.String ns) [0x00000]
  at System.Xml.Linq.XNodeReader.GetAttribute (System.String local,
System.String ns) [0x00000]
  at System.Xml.Serialization.XmlSerializationReader.GetNullAttr () [0x00000]
  at System.Xml.Serialization.XmlSerializationReader.ReadNull () [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 type
Map, 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:
Value

How often does this happen? 
Always

Additional Information:
Attempt to use validating reader around XNodeReader still cause an exception:
System.ArgumentOutOfRangeException : Less than 0 or more than list count.
Parameter name: index
-1
  at System.Collections.ArrayList.RemoveAt (Int32 index) [0x00000] 
  at System.Xml.Schema.XmlSchemaValidator.ValidateEndElement
(System.Xml.Schema.XmlSchemaInfo info, System.Object var) [0x00000] 
  at System.Xml.Schema.XmlSchemaValidator.ValidateEndElement
(System.Xml.Schema.XmlSchemaInfo info) [0x00000] 
  at Mono.Xml.Schema.XmlSchemaValidatingReader.Read () [0x00000] 
  at System.Xml.XmlReader.ReadString () [0x00000] 
  at System.Xml.Serialization.XmlSerializationReader.ReadString (System.String
value) [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]


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