RSB: serializer issues

3 views
Skip to first unread message

Vadim Kantorov

unread,
Oct 23, 2009, 5:59:21 PM10/23/09
to Rhino Tools Dev
Found out XmlMessageSerializer doesn't support Dictionaries and
subclasses of generic collections (sublcasses of Dictionary or List).

var ms = new MemoryStream();
var serializer = new XmlMessageSerializer(new DefaultReflection(), new
DefaultKernel());
serializer.Serialize(new []{new Dictionary<string, int>{{"abs", 1}}},
ms );
ms.Position = 0;
serializer.Deserialize(ms);

Am I missing anything?

Mike Nichols

unread,
Oct 23, 2009, 6:45:48 PM10/23/09
to rhino-t...@googlegroups.com
doesn't this have to do with dictionaries not being serializable in .net?

Corey Kaylor

unread,
Oct 23, 2009, 6:53:27 PM10/23/09
to rhino-t...@googlegroups.com
The XmlMessageSerializer technically does not (last I remember) put any constraints for things to be serializable. I am pretty sure a patch would be acceptable, or other alternatives would be to implement ICustomElementSerializer.

Ayende Rahien

unread,
Oct 23, 2009, 7:06:11 PM10/23/09
to rhino-t...@googlegroups.com
Yep, a patch would be welcome

Udi Dahan

unread,
Oct 24, 2009, 6:34:49 AM10/24/09
to Rhino Tools Dev
Keep in mind that when serializing a Dictionary<T, K> you need to
recursively open up each of the enclosed types.

This took a bit of work to get right in NServiceBus.

-- Udi Dahan
Reply all
Reply to author
Forward
0 new messages