c# - Can adding new ProtoInclude attribute be made to not break backwards compatibility -


We have been running in the compatibility problems of the back, where we have added a new sub-class of a Protokufed interface, but This means that this object can not be opened in previous versions.

The general is right, all our deserialized objects that are so different, so not pull everything else so failure to deserialize Unfortunately, the interface is arranged in a list, so that The full list of the presence of new type of objects in the class will arise due to not being deserialized.

Is there a way to mark a category or list Older version in Current version will leave those items which can not be satisfied.

Still clear, we are thinking about this: serializing modify this side of the problem.

A test to repeat exceptions:

  using System.IO; Using NUnit.Fraamework; Using ProtoBuff; Namespace UnitTest.ProtoBuf {[ProtoContract] [ProtoInclude (1, typeof (ImplementorInV2))] internal interface IInterfaceV2 {} [ProtoContract] internal interface IInterfaceV1 {} [ProtoContract] internal class ImplementorInV2: IInterfaceV2 {[ProtoMember (1)] public string Member {receives; Set; }} [Testficaccr, Category ( "Framework")] internal category proto include Krenadedtest {[Test] public void Besiktest () {var a = new ImplementerInV2 (); A.member = "bla bla"; Byte [] buffer; IInterfaceV1 aCopy; (Using Var stream = new memorystream) {Serializer.Serialize (Stream, A); Buffer = stream. Tore (); } (Var stream = New memorystream (buffer)) using {aCopy = Serializer.Deserialize & lt; IInterfaceV1 & gt; (section); }}}}}  

In general: yes-eye; In your specific scenario - perhaps not, if it was class succession, then it would be deserialize as far as possible , that is, if you

  [ProtoContract] class Foo {} // v1  

and

  [ProtoContract, ProtoInclude (1, typeof (time))] class Foo {} [ProtoContract] class times: Foo {} / / V 2  

and a serial bar V 2, a v1 client just code it <> Fu are deserialize as and ignore unexpected data. However, the problem with your case is that does not have any default implementation for any interface - it can not make anything in fact, for this reason specify the default type for the list etc. is actually a way, but as long as you have deployed, you can organize the v2 code.


Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -