rikimaru0345 / Ceras

Universal binary serializer for a wide variety of scenarios https://discord.gg/FGaCX4c
MIT License
484 stars 53 forks source link

Deserialize already serialized istance of class failed when i add field to class #99

Open StefanoAnversa opened 2 years ago

StefanoAnversa commented 2 years ago

Good morning,

i have this problem. I serialized a istance of my class "Area" and i save it on Redis Repository. The "Area" class has a list of item WorkCenter This is the old definition of "WorkCenter"

image

Now i edited the class and i add new field and added on Empy Constructor the default value of new field image

Now when i try to deserialize istance saved on Redis with new definition (i use the deserialize method with generic type) i get this error:

"Index was out of range. Must be non-negative and less than the size of the collection. Arg_ParamName_Name"

Do you have any idea how I can fix this?

On this link: "https://github.com/rikimaru0345/Ceras/wiki/Optimization-&-Pitfalls" is written that "Ceras supports removing, renaming, and adding new fields (or properties), but changing the type of an existing member will not work. If you need that feature let me know and I'll add it". So I expected that adding a field would have no problems but it isn't.