I was receiving a "cannot serialize type..." error while attempting to serialize a BindingList. My initial thought was that the collection was the problem. I bypassed the collection and attempted to return a single instance of the class...same error. The classes are contained in a seperate project (but in the same solution); my next move was to copy and paste the class from the external project into the WCF project. With no other changes, the object now serializes.
Is this a namespace or persmissions issue? I can't rearchitect the solution at this point. What would prevent the class from seralizing in another project with the same code? Thanks in advance.
Often when we get this error there is a sub class that does not have the Serializable or DataContract / DataMember attribute.
What is the class that you are using as T? Is that class marked as serializable?
For the error in the comment see "An attempt was made to load a program with an incorrect format" even when the platforms are the same
The fix for this was to simply recreate the WCF solution and add the class library projects to it. I have no idea what the problem was. Maybe bad meta information or something.