Binary serialization versioning issue

317 Views Asked by At

I have a class implementing ISerializable. Old binary data cannot be deserialized after adding new field to that class due to the following error:

SerializationException: No element named 'x' could be found.

Shouldn't serializer automatically assign null or 0 to that field in this case? I tried using Attribute [OptionalField(VersionAdded = 2)] but with the same result.

I can handle it by checking if field name exists in SerializationEntry array but is this the right way to do it? Is there a better way?

0

There are 0 best solutions below