locked
Type Cannot Be Serialized RRS feed

  • Question

  • Hi,

    I'm trying to send over a System.Web.SessionState.SessionStateItemCollection as a parameter in a WCF method.  Just starting the service gives the following error:

    Type 'System.Web.SessionState.SessionStateItemCollection' cannot be serialized.  Consider marking it with the DataContractAttribute attribute, and marking all of its members you want serialized with the DataMemberAttribute attribute.

    Now, since SessionStateItemCollection is a System.Collections.Specialized.NameObjectCollectionBase, it already implements the System.Runtime.Serialization.ISerializable interface.

    According to the article in http://msdn2.microsoft.com/en-gb/library/ms731923.aspx, sixth bullet item, included in the types that can be serialized with the DataContractSerializer are "types marked with the SerializableAttribute attribute. Many types included in the .NET Framework base class library fall into this category. The DataContractSerializer fully supports this serialization programming model that was used by .NET Remoting, the BinaryFormatter, and the SoapFormatter, including support for the ISerializable interface. "

    So, I must be missing something.  Anybody run into something similar that can lead me to a solution?

     

    Cal

    Wednesday, January 17, 2007 8:59 PM

Answers