[Mono-bugs] [Bug 76860][Nor] New - XmlSerializer's doens't handle XmlAttribute right

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Wed Nov 30 03:44:57 EST 2005


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by borodin at zg.bezopasnost.ru.

http://bugzilla.ximian.com/show_bug.cgi?id=76860

--- shadow/76860	2005-11-30 03:44:57.000000000 -0500
+++ shadow/76860.tmp.13257	2005-11-30 03:44:57.000000000 -0500
@@ -0,0 +1,125 @@
+Bug#: 76860
+Product: Mono: Class Libraries
+Version: 1.1
+OS: GNU/Linux [Other]
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: Sys.XML
+AssignedTo: atsushi at ximian.com                            
+ReportedBy: borodin at zg.bezopasnost.ru               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: XmlSerializer's doens't handle XmlAttribute right
+
+If one specifies DataType ("anyURI" for instance) in XmlAttribute attribute
+of field of type string[], Mono's XmlSerializer fails to deserialize, while
+MS's works ok. Mono version is 1.1.10.
+
+code:
+
+using System;
+using System.IO;
+using System.Xml;
+using System.Xml.Serialization;
+
+namespace test
+{
+    public class main
+    {
+        [XmlAttribute(DataType="anyURI")]
+        public string[] location1=new string[] {"test1","test2"};
+
+        public static void Main()
+        {
+            XmlSerializer ser=new XmlSerializer(typeof(main));
+            ser.Serialize(Console.Out,new main());
+
+            StringWriter w=new StringWriter();
+            ser.Serialize(w,new main());
+            main o=(main)ser.Deserialize(new StringReader(w.ToString()));
+
+            Console.WriteLine();
+            Console.WriteLine("{0}",o.location1.Length);
+        }
+    }
+}
+
+output on MS.NET:
+
+<?xml version="1.0" encoding="cp866"?>
+<main xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+xmlns:xsi="http://www.w3.org/
+2001/XMLSchema-instance" location1="test1 test2" />
+2
+
+output on Mono:
+
+mono --debug xmlserializer01.exe
+
+<?xml version="1.0" encoding="utf-8"?>
+<main xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+location1="System.String[]" />
+Unhandled Exception: System.ArgumentException: Object type System.String
+cannot be converted to target type: System.String[]
+Parameter name: val
+in [0x0008c] System.Reflection.MonoField:SetValue (System.Object obj,
+System.Object val, BindingFlags invokeAttr, System.Reflection.Binder
+binder, System.Globalization.CultureInfo culture)
+in [0x00006] (at
+/var/tmp/portage/mono-1.1.10/work/mono-1.1.10/mcs/class/corlib/System.Reflection/FieldInfo.cs:153)
+System.Reflection.FieldInfo:SetValue (System.Object obj, System.Object value)
+in [0x0004d] (at
+/var/tmp/portage/mono-1.1.10/work/mono-1.1.10/mcs/class/System.XML/System.Xml.Serialization/XmlTypeMapMember.cs:102)
+System.Xml.Serialization.XmlTypeMapMember:SetValue (System.Object ob,
+System.Object value)
+in [0x0001d] (at
+/var/tmp/portage/mono-1.1.10/work/mono-1.1.10/mcs/class/System.XML/System.Xml.Serialization/XmlSerializationReaderInterpreter.cs:541)
+System.Xml.Serialization.XmlSerializationReaderInterpreter:SetMemberValue
+(System.Xml.Serialization.XmlTypeMapMember member, System.Object ob,
+System.Object value, Boolean isValueList)
+in [0x000a2] (at
+/var/tmp/portage/mono-1.1.10/work/mono-1.1.10/mcs/class/System.XML/System.Xml.Serialization/XmlSerializationReaderInterpreter.cs:250)
+System.Xml.Serialization.XmlSerializationReaderInterpreter:ReadMembers
+(System.Xml.Serialization.ClassMap map, System.Object ob, Boolean
+isValueList, Boolean readByOrder)
+in [0x0000f] (at
+/var/tmp/portage/mono-1.1.10/work/mono-1.1.10/mcs/class/System.XML/System.Xml.Serialization/XmlSerializationReaderInterpreter.cs:223)
+System.Xml.Serialization.XmlSerializationReaderInterpreter:ReadClassInstanceMembers
+(System.Xml.Serialization.XmlTypeMapping typeMap, System.Object ob)
+in [0x000d8] (at
+/var/tmp/portage/mono-1.1.10/work/mono-1.1.10/mcs/class/System.XML/System.Xml.Serialization/XmlSerializationReaderInterpreter.cs:214)
+System.Xml.Serialization.XmlSerializationReaderInterpreter:ReadClassInstance
+(System.Xml.Serialization.XmlTypeMapping typeMap, Boolean isNullable,
+Boolean checkType)
+in [0x00035] (at
+/var/tmp/portage/mono-1.1.10/work/mono-1.1.10/mcs/class/System.XML/System.Xml.Serialization/XmlSerializationReaderInterpreter.cs:176)
+System.Xml.Serialization.XmlSerializationReaderInterpreter:ReadObject
+(System.Xml.Serialization.XmlTypeMapping typeMap, Boolean isNullable,
+Boolean checkType)
+in [0x0005b] (at
+/var/tmp/portage/mono-1.1.10/work/mono-1.1.10/mcs/class/System.XML/System.Xml.Serialization/XmlSerializationReaderInterpreter.cs:168)
+System.Xml.Serialization.XmlSerializationReaderInterpreter:ReadRoot
+(System.Xml.Serialization.XmlTypeMapping rootMap)
+in [0x00034] (at
+/var/tmp/portage/mono-1.1.10/work/mono-1.1.10/mcs/class/System.XML/System.Xml.Serialization/XmlSerializationReaderInterpreter.cs:88)
+System.Xml.Serialization.XmlSerializationReaderInterpreter:ReadRoot ()
+in [0x00022] (at
+/var/tmp/portage/mono-1.1.10/work/mono-1.1.10/mcs/class/System.XML/System.Xml.Serialization/XmlSerializer.cs:333)
+System.Xml.Serialization.XmlSerializer:Deserialize
+(System.Xml.Serialization.XmlSerializationReader reader)
+in [0x0002e] (at
+/var/tmp/portage/mono-1.1.10/work/mono-1.1.10/mcs/class/System.XML/System.Xml.Serialization/XmlSerializer.cs:322)
+System.Xml.Serialization.XmlSerializer:Deserialize (System.Xml.XmlReader
+xmlReader)
+in [0x00010] (at
+/var/tmp/portage/mono-1.1.10/work/mono-1.1.10/mcs/class/System.XML/System.Xml.Serialization/XmlSerializer.cs:310)
+System.Xml.Serialization.XmlSerializer:Deserialize (System.IO.TextReader
+textReader)
+in [0x0003e] (at
+/home/laad/shared/projects/testcases/xmlserializer01.cs:22) test.main:Main ()


More information about the mono-bugs mailing list