[Mono-dev] Bug in XmlSerializer Deserialize?

Atsushi Eno atsushi at ximian.com
Wed Oct 24 11:18:29 EDT 2007


Hi,

The actual fully compilable code that demonstrates your issue would
be more helpful to find out what is going on there.

Atsushi Eno

Thempra wrote:
> Hi,
> 
>      I try to migrate a WebService of .NET to Mono. But allways get the 
> same Exception when Deserialze a XML, and every time I read the 
> StreamReader the Exception jump in a different position.
> 
> My code is:
> 
>             StreamReader sr = new StreamReader(URL);
>             XmlSerializer xs = new XmlSerializer(typeof(CLASSGENERATED));
> 
>             CLASSGENERATED element=(CLASSGENERATED)xs.Deserialize(sr);
> 
> 
> And the CLASSGENERATED it's make with xsd.exe
> 
> [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "2.0.50727.42")]
> [System.SerializableAttribute()]
> [System.Diagnostics.DebuggerStepThroughAttribute ()]
> [System.ComponentModel.DesignerCategoryAttribute("code")]
> [System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true, 
> Namespace="http://www.xxxxxxxxx.xx/XXXXXX 
> <http://www.xxxxxxxxx.xx/XXXXXX>")]
> [System.Xml.Serialization.XmlRootAttribute(Namespace="http://www.xxxxxxx.xxxx/XXXXXX", 
> IsNullable=false)]
> public partial class CLASSGENERATED {
> ...........
> .........
> 
> 
> 
> EXCEPTION:
> 
> Message:
> 
> parameters
> 
> 
> StackTrace:
> 
> at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, 
> System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] 
>   at System.Reflection.MonoProperty.SetValue (System.Object obj, System.Object value, BindingFlags invokeAttr, System.Reflection.Binder binder, 
> System.Object[] index, System.Globalization.CultureInfo culture) [0x00000] 
>   at System.Reflection.PropertyInfo.SetValue (System.Object obj, System.Object value, System.Object[] index) [0x00000] 
>   at System.Xml.Serialization.XmlTypeMapMember.SetValue
>  (System.Object ob, System.Object value) [0x00000] 
>   at System.Xml.Serialization.XmlSerializationReaderInterpreter.SetMemberValue (System.Xml.Serialization.XmlTypeMapMember member, System.Object ob, System.Object value, Boolean isValueList) [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.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.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] XML Serializer(System.Xml.Serialization.XmlSerializer): System.Xml.Serialization.XmlSerializerSTEAMREADER
> (System.IO.StreamReader)
> 
> 
> 
> I run it in Debian with Mono 1.5.1 and XSP. Thx.
> 
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list




More information about the Mono-devel-list mailing list