in Uncategorized

Collection properties need a setter implementation when using DataContractSerializer

I was having a problem with serializing a FaultException that had a custom details class that was a collection. Today I figured out that, when using the DataContractSerializer, you need to make sure you provide a setter implementation even for your collection based properties. Once again, this is a departure from the way that the XmlSerializer works. I’m trying to work through the scenarios where this is any kind of improvement over XmlSerializer, but I cannot think of any problem this solves.

Welp, I hope this saves someone else some headscratching. I truly hope Microsoft lifts the restriction of only being able to serialize fault details with the DataContractSerializer… I’m just not a fan of it at all.

Leave a comment