msgpack-cli icon indicating copy to clipboard operation
msgpack-cli copied to clipboard

New added property can't deserialized.

Open SweetWanny opened this issue 8 years ago • 2 comments

pulblic class SzTEST { public SzTEST() { }

// File version 1.0
[MessagePackMember(1)]
public string A { get; set; }

// File version 1.0
[MessagePackMember(2)]
public string B { get; set; }

// File version 1.0
[MessagePackMember(3)]
public string C { get; set; }

// File version 1.1
[MessagePackMember(4)]
public string D { get; set; }  // <- This property added on version 1.1

}

This is simple scenario for example. Suppose If I'm used SzTEST serialized and save as file. As time goes, a new requirement is occurred. So, adding a new property D for user request. But D can't deserialized on file version 1.0 and throws exception. ('Cannot deserialize member 'System.String D' of type SzTest') How I resolve it? I know IUnpackable interface implements is an alternative solution. But my real scenario has an very complex objects and fields to resolve it.

SweetWanny avatar Jun 01 '17 02:06 SweetWanny

Sorry for delay.

It is not expected behavior at least in the latest version, and I cannot reproduce the problem. Could you put the code to reproduce, actual file which contains serialized binaries, and stacktrace of the error?

yfakariya avatar Jun 11 '17 11:06 yfakariya

I'm used in version 0.6.0. I'm upgrade to version 0.8.1. It's works well. :) Thank you for your answer.

SweetWanny avatar Jun 12 '17 06:06 SweetWanny