.net - C# Serialization issues while mapping one version of a type to a different version of a type -
background
have encountered strange situation in application uses 3rd party component. quite few classes in application implements iserializable interface persist object state , forth. face compatibility issues during course of serialization when serialize app classes in 1 version , try deserialize different version of 3rd party component.
issue
latest release of 3rd party component saw major shuffling w.r.t types , assemblies.
i.e. ex :
earlier type t1 found under assembly a1. . post new release, assembly a1 has been split 2 different assemblies ex: a11 , a12. , type t1 housed in a12
the type t1 on deserialization, trying find assembly a1. since has been moved different assembly a12 throwing serializationexception stating not able find assembly a1.
things tried:
1. serializationbinder:
used serializationbinder class checked incoming assemblyname , typename information , suitably routed correct assembly on deserialization.
2. assemblyresolve event using resolveeventhandler delegate
can extract assembly file name assembly’s identity , can re-route updated path application can find assembly file using call assembly.loadfrom load assembly , return resulting assembly reference resolveeventhandler method
although both of above approach works extent. quite task supply routing information correct assembly types marked serializable in application. not mention has updated again future releases.
so i'm here ask help/suggestions/alternatives
has here has experienced such situation ? how able tackle such issue ? if generous shed best practices , pitfalls avoid when using serialization 3rd party components
cheers , in advance vatsag
about binaryformatter: what deficiencies of built-in binaryformatter based .net serialization?
Comments
Post a Comment