[Mono-list] problem with xml deserialization and XML "choice"

Josef Semmler josef.semmler at gmail.com
Tue Jan 10 12:06:34 EST 2012


i have the following issue with xml deserialization:

I have a xml schema which uses a "choice" - when i try to deserialize a XML
file based on this schema into a class instance i get the following error

Unhandled Exception: System.InvalidOperationException: There is an error in
XML document. ---> System.InvalidOperationException: Read by order only
possible for encoded/bare format
  at System.Xml.Serialization.ClassMap.GetElement (Int32 index) [0x00000]
in <filename unknown>:0
  at System.Xml.Serialization.XmlSerializationReaderInterpreter.ReadMembers
(System.Xml.Serialization.ClassMap map, System.Object ob, Boolean
isValueList, Boolean readBySoapOrder) [0x00000] in <filename unknown>:0
(System.Xml.Serialization.XmlTypeMapping typeMap, System.Object ob)
[0x00000] in <filename unknown>:0
(System.Xml.Serialization.XmlTypeMapping typeMap, Boolean isNullable,
Boolean checkType) [0x00000] in <filename unknown>:0
  at System.Xml.Serialization.XmlSerializationReaderInterpreter.ReadObject
(System.Xml.Serialization.XmlTypeMapping typeMap, Boolean isNullable,
Boolean checkType) [0x00000] in <filename unknown>:0
  at System.Xml.Serialization.XmlSerializationReaderInterpreter.ReadRoot
(System.Xml.Serialization.XmlTypeMapping rootMap) [0x00000] in <filename
  at System.Xml.Serialization.XmlSerializationReaderInterpreter.ReadRoot ()
[0x00000] in <filename unknown>:0
  at System.Xml.Serialization.XmlSerializer.Deserialize
(System.Xml.Serialization.XmlSerializationReader reader) [0x00000] in
<filename unknown>:0
  --- End of inner exception stack trace ---

The code itself works. It works with microsoft .net and works also pretty
good with with mono 2.6.7 ... but it seems that all mono version after
2.6.7 are no longer able to process the "choice" ?
(btw: Code was compiled with VS)

Is this a known issue?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-list/attachments/20120110/64069428/attachment-0001.html 

More information about the Mono-list mailing list