Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Tom-Kingstone opened this issue Feb 18, 2025 · 0 comments · May be fixed by #3463
Assignees
Labels
type:bug Error or unexpected behaviour

Comments

@Tom-Kingstone
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:bug Error or unexpected behaviour
Projects
None yet
1 participant