[Mono-list] XmlWriter with XmlWriterSettings break Dictionary de-serialization

Uli Hertlein uli at xdt.com.au
Tue Mar 8 00:06:37 EST 2011

Hi guys,

I am serializing a Dictionary<Guid,SomeClass> to an XML file using DataContractSerializer and 

When using 'XmlWriterSettings() { Indent=true }' (and the Dictionary contains more than one entry) 
the de-serialization (using DataContractSerializer and Stream) breaks with the following exception:

$ mono ./DictSerializer.exe
System.Runtime.Serialization.SerializationException: Deserializing type 
'System.Collections.Generic.Dictionary`2[[System.Guid, mscorlib, Version=, Culture=neutral, 
PublicKeyToken=b77a5c561934e089],[DictSerializer.Bit, DictSerializer, Version=, 
Culture=neutral, PublicKeyToken=null]]'. Expecting state 'EndElement'. Encountered state 'Element' 
with name 'd2p1:KeyValueOfguidBit' with namespace 
'http://schemas.microsoft.com/2003/10/Serialization/Arrays'. (10,6)
   at System.Runtime.Serialization.SerializationMap.DeserializeObject (System.Xml.XmlReader reader, 
System.Runtime.Serialization.XmlFormatterDeserializer deserializer) [0x00000] in <filename unknown>:0
   at System.Runtime.Serialization.XmlFormatterDeserializer.DeserializeByMap 
(System.Xml.XmlQualifiedName name, System.Type type, System.Xml.XmlReader reader) [0x00000] in 
<filename unknown>:0

This is with mono-2.10.1, MS .NET 4 is fine.
Attached a minimal application that demonstrates this behaviour.
What's the established procedure to file a bug?


Ulrich Hertlein
Research and Development   mailto:uli at xdt.com.au
XDT Pty Ltd                http://www.xdt.com.au
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: Program.cs
Url: http://lists.ximian.com/pipermail/mono-list/attachments/20110308/6dba3bf2/attachment.pl 

More information about the Mono-list mailing list