Boost logo

Boost Users :

Subject: Re: [Boost-users] Serialization and class versioning
From: Robert Ramey (ramey_at_[hidden])
Date: 2018-08-02 16:07:06


On 8/2/18 4:58 AM, Tim Burgess via Boost-users wrote:
> Hi,
>
> I have an application that uses serialization for data
> storage/retrieval, based on Boost 1.67.0. I’ve implemented class
> versioning as per:
>
> https://www.boost.org/doc/libs/1_67_0/libs/serialization/doc/tutorial.html#versioning
>
> The overall archive stores a number of sub-classes, nested within the
> XML. However, I get a run-time exception thrown that I can’t catch when
> one of my sub-classes (DisplayDefinition) returns from being read in. A
> bit of debugging found that the problem was caused by the class version
> number having a value of 0, whilst the file being read had a version
> number of 3 for the class in question.

A couple of possibilites

a) something else is messed up and the values get out of sync. Using
XML should be detected as it checks the end tags to be sure they match
the start tags. So this is not likely it.

b) determine how the input file got the version number 3 in the first
place. Did it previously have a version # of 3? Did you change it back
to 0 - lowering the version # would create this problem.

c) If it's showing up on newly create files - it's easy, just debug and
find the place where the version # is being written.

Robert Ramey


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net