I have a client and a server application which communicate over .NET 2.0 Remoting using binary serialization.
A small change has been made to one of the data transfer object's interface and the implementing class, well, an array of strings field was added.
If I to redeploy a new version of server application, will my old clients continue to work?
I would think they would, since nothing has been deleted from interface and direct implementation, but I am not sure.
It probably boils down to another question - is a binary deserialiser "clever enough" to handle the situation like this by initializing a fields it fails to find data in the input binary stream to null, or is it going to break and to throw the exception?
You can add an attribute to the new property: OptionalField
. Without the attribute, the deserializer will not be able to convert serialized data back to the updated definition. The attribute is to ensure the deserializer can handle the "missing" data gracefully.
If you want to set a default value for the new property, in the case that no appropriate data for it is deserialized, implement the IDeserializationCallback
interface, and set the default value, if any, in the resulting method.