jugstalt / gview-gis

gView GIS - Userfriendly open source GI framework
Apache License 2.0
10 stars 4 forks source link

Regards ASP.NET 7.0 #21

Closed charga closed 2 months ago

charga commented 1 year ago

In JsonGeometry // AREA [JsonProperty("rings", NullValueHandling = NullValueHandling.Ignore)] public double?[][,] Rings { get; set; }

    // POLY LINE
    [JsonProperty("paths", NullValueHandling = NullValueHandling.Ignore)]
    public double?[][,] Paths { get; set; }

System.Text.Json seems to not support multidimension arrays like double?[][,]. I'll tried to move to 7.0, but its produce an error: System.NotSupportedException: The type 'System.Double[,]' is not supported. at System.Text.Json.ThrowHelper.ThrowNotSupportedException_SerializationNotSupported(Type propertyType)

If I change property to List<List<double[]>> seems to work, Need to change a lot, I think. keep in mind if you plan to move

Regards

Carlos

jugstalt commented 1 year ago

Hi Carlos,

thanks for the tip.

Until now, the gView.Server uses .NET 6 and for serialization its still uses Newtonsoft.Json. In my Startup.cs i use:


services.AddMvc(...).AddNewtonsoftJson(...)

So i think, Newtonsoft also used when the gView.Server returns JSON from an controller.

What have u changed to .NET 7.0? The gView.Server? Or do u use the JsonGeometry Model from you own project. How can i reproduce this error?

Regards and thx for using gView Jürgen

charga commented 1 year ago

I'll made a new minimal API (7.0) using your JsonGeometry Model...And the serializer ignore NullHandling attribute. So searching internet read about NET 7.0 API. I'll continue investigating