I’ve got a method on a WCF service that returns an ObservableCollection<T>. On the server side, before returning the result, I can see that the collection is populated with items and the items contain the data as expected. On the client side, the collection is populated with the same number of items as on the server side, but all of the properties in each item are null (there are four strings and an enumerated type).
The type declaration for the items being returned is not decorated with the [DataContract] and [DataMember] attributes, as it resides in a shared .dll, and this has not been a problem for any other types in this assembly until now. This particular type is decorated with the [Serializable] attribute Catching the response in Fiddler shows that the items still contain data before being deserialized. Why would the values of the items’ properties be lost in deserialization?
Just for kicks I decorated it with
[DataContract]and[DataMember]attributes, and that did the trick. It would appear that the enum didn’t serialize/deserialize correctly. Wish I had a better idea as to why, though.