views:

19

answers:

0

I'm ran into a scenario recently where one of our devs added an object to our data contract that was not marked as a data member. We are using using the DataContractSerializer to store a configuration file for a piece of hardware we are controlling. The serialize operation did not succeed, obviously.

The major problem this uncovered was that the configuration file got destroyed during the process. Does anyone know of a way to make sure the object graph will serialize prior to trying to serialize it?

The stack trace from the serialization exception fails at a call to XmlObjectSerializerContext.CheckIfTypeSerializable(..) I'm wondering if there is something like this, that I can use prior to trying to serialize.

I would like to avoid having to stream the graph to memory and then to file, but I guess this would work...

Any suggestions?