Reputation: 195
I am trying to deserialize a file which is serialized using an older version.
In the new version, We have done the following things
I know using SerializationBinder can solve issue 1. For the new added class member, I have marked with [NonSerialized]. But I still get deserialization error.
Any pointers?
Upvotes: 3
Views: 559
Reputation: 1062955
I hate to say it, but my first pointer here would be "don't do that" - BinaryFormatter
is very brittle - and while you can often bang your head on the keyboard for 6 hours to get past each successive pain point, it really isn't worth it. There are many many reasons I always say "don't use BinaryFormatter
" - you've sadly found 4 of them. Frankly, my recommendation would be:
BinaryFormatter
(except perhaps NetDataContractSerializer
, which goes and repeats all the same mistakes; DataContractSerializer
is ok-ish, though)Sorry that isn't more positive...
Upvotes: 2