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

Additional Properties Serialization Error #854

Open
sanchez opened this issue Aug 9, 2022 · 4 comments
Open

Additional Properties Serialization Error #854

sanchez opened this issue Aug 9, 2022 · 4 comments
Labels
Bug Something isn't working
Milestone

Comments

@sanchez
Copy link

sanchez commented Aug 9, 2022

Describe the bug
I have an output of a function that is adding about 800 ModelCurves, and then another function reading these in and performing an operation on each of them. Interestingly the reading function can only read in about 590 ModelCurves, I then created a unit test of the second function and can verify there is the correct number of ModelCurves on the inputModel. From here I made a small modification to the unit test to expose any serialization errors and found there was in fact some warnings:

image

Interestingly I was also writing some properties to the AdditionalProperties property on the ModelCurve, if I comment out that functionality in the first function then the second function can read in all the ModelCurves perfectly fine.

Expected behavior
I would expect writing to AdditionalProperties should not affect the core properties of the element?

Desktop (please complete the following information):

  • OS: Firefox, Visual Studio 2022, Windows 10
@sanchez
Copy link
Author

sanchez commented Aug 9, 2022

Additionally I would have expected these serialization errors to appear somewhere in the unit test or UI but doesn't seem to be the case?

@andrewheumann
Copy link
Member

Can you share a code sample that would let us reproduce this issue in order to track it down?

@sanchez
Copy link
Author

sanchez commented Aug 12, 2022

string filePath = input.FileInput.LocalFilePath;

if (!File.Exists(filePath))
{
    output.Errors.Add("Input file does not exist");
    return output;
}

string data = File.ReadAllText(filePath);
FeatureCollection features = JsonConvert.DeserializeObject<FeatureCollection>(data);

Material lineMaterial = new Material("Brown", Colors.Brown);

foreach (Feature feature in features.Features)
{
    if (feature.Geometry is LineString lineString)
    {
        List<Vector3> points = lineString.Coordinates
            .Select(x => new Vector3(x.Longitude + input.XOffset, x.Latitude + input.YOffset, x.Altitude ?? -999))
            .ToList();
        Polyline polyline = new Polyline(points);
        ModelCurve curve = polyline;
        curve.AdditionalProperties = feature.Properties;

        output.Count++;
        output.Model.AddElement(curve);
    }
}

@sanchez
Copy link
Author

sanchez commented Aug 12, 2022

On the geojson file there is a property which has a GUID property but I am not currently doing anything with it: "GlobalID": "{EB751D56-6E3A-4026-A1FB-1E9C76332831}" and some other properties that might collide too: "OBJECTID": 1458, "Unique Identifier": 3,

@ikeough ikeough added the Bug Something isn't working label Aug 25, 2022
@ikeough ikeough added this to the 2.0 milestone Apr 17, 2023
@andrewheumann andrewheumann removed their assignment Apr 17, 2023
@ikeough ikeough modified the milestones: 2.0, 0.2.1, 2.1 Apr 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants