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.

About these ads

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s