Skip to content

Serialiser_Engine: Converting from string (or other System type) to IObject does not check that data has been lost #3462

Open
@Tom-Kingstone

Description

@Tom-Kingstone

Description:

When a property of an object has been converted from a system type (e.g. System.String) to an IObject, when deserialising from an old version, the property in question (if the old property is not null) deserialises as null, which is a valid value for an IObject, so deserialisation carries on as normal.

There is no check that the original value was not null. This leads to data loss as the deserialiser doesn't have mismatches on property types, so the upgrader for the object is not run, which means that explicit versioning upgrades are not applied unless there is some other issue with the object.

Steps to reproduce:

clone the LadybugTools_Toolkit repository, checkout LadybugTools_Toolkit-#296-SeparateSimulationFromPlotting and build, then clone Versioning_Toolkit, checkout the same named branch there and build. Then open the provided grasshopper script.

The FromJson method should return a SimulationResult, but the EpwFile FileSettings property will be missing FileName and Directory information.

Expected behaviour:

FileName and Directory should be set.

Test file(s):

Unzip this and make sure that both the json and gh files are in the same folder, then run the gh script:
serialiser.zip

@IsakNaslundBh

Metadata

Metadata

Assignees

Labels

type:bugError or unexpected behaviour

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions