Skip to content

Versioning of dictionarys #209

@FraserGreenroyd

Description

@FraserGreenroyd

Description:

Objects with properties that are of type Dictionary don't upgrade their documents, which is a problem if the key or value is a BHoM object which also needs upgrading.

This has been found as a result of this PR where the property has changed from double to string. The versioning upgrader was originally failing with a stack overflow on the bot, which was resolved with this PR on Versioning_Toolkit. However, by 'resolved', what I mean here is the stack overflow went away, but versioning then broke.

These are the check details for the failure which highlight the problem isn't with an object associated to those that have changed. What has happened here, is when the end-of-milestone versioning datasets are produced, objects which contain a List<IBHoMObject> or Dictionary with an IBHoMObject for key or value, the dataset uses the first object it finds for those checks.

What this has thus highlighted, where the Markup object from XML is the one chosen for the 5.3 datasets, is that the BH.oM.Analytical.Elements.ShortestPathResult object which contains a property of type BH.oM.Analytical.Elements.Relation which has a property of type BH.oM.Analytical.Elements.Relation which has a property of type Dictionary<Guid, IBHoMObject> called Entities where the IBHoMObject value is not being upgraded.

Following debugging, I found this bit of code:

if (document.Contains("_t"))
{
    if (document["_t"] == "System.Reflection.MethodBase")
        result = UpgradeMethod(document, converter);
    else if (document["_t"] == "System.Type")
        result = UpgradeType(document, converter);
    else
        result = UpgradeObject(document, converter);
}

For Dictionary objects, the document objects don't contain _t so the result is null and no upgrade is handled. This is what I aim to fix in the PR for XML.

Metadata

Metadata

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