Pavel Minaev
6/28/2008 4:07:00 PM
On Jun 26, 7:33 pm, "Oriane" <ori...@noemail.noemail> wrote:
> in an Asp.net application, a class GfProjects I used in a Profile implements
> IDictionary. The class is marked as [Serializable] and the profiles appear
> to be saved and read succesfully. However, I've build an Asp.Net web service
> which gets this profile field, and when I test it on IE, I get the following
> message:
>
> "Cannot serialise member XXX.GfProjects of type
> System.Collections.Generic.Dictionary`2[[System.String, mscorlib,
> Version=2.0.0.0, Culture=neutral,
> PublicKeyToken=b77a5c561934e089],[Gilif.Auth.GilifProject, Gilif.Auth,
> Version=1.0.0.0, Culture=neutral, PublicKeyToken=4df35566e5ba3853]], since
> it is implementing IDictionary."
>
> So what ?
In the second case, you're actually using XML serialization via
XmlSerializer. That one, indeed, does not support IDictionary for some
obscure reasons (though you can write your own class that implements
IDictionary but is serializable regardless - if you implement
IXmlSerializable explicitly).
On a side note, if you migrate your web service to WCF instead, you
won't have this problem - it uses DataContractSerializer instead of
XmlSerializer, and the former fully supports IDictionary,