1

Closed

SerializableExpression not serializable with DataContractSerializer

description

I tried using the SerializableExpression from LINQ to send an expression through a WCF webservice. Alas the SerializableExpression contains InterLinqType which itself contain the "public Type RepresentedType" property which is not serializable (because System.Type (i.e. RuntimeType) is not serializable) but marked with the DataMember attribute.
Is there a reason for that which I missed?
 
I changed the code to:
[DataMember(Name = "RepresentedType")]
    private String m_representedType;
 
    /// <summary>
    /// Gets or sets the represented <see cref="Type"/>.
    /// </summary>        
    public Type RepresentedType {
        get { return Type.GetType(m_representedType); }
        set { m_representedType = value.AssemblyQualifiedName; }
    }
 
and changed all access to m_representedType to the property. That allowed serialization using the DataContract serializer.
Closed Sep 10, 2009 at 6:50 AM by mbauer
Fixed a long long long time ago (last month).

comments

GaussZ wrote Jun 5, 2008 at 5:59 PM

Forgot to add: The reason for this work item is to request integrating the change into interlinq :)

wrote Sep 10, 2009 at 6:50 AM

wrote Feb 14, 2013 at 3:02 AM

wrote May 16, 2013 at 8:23 AM