You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
Having a int[][] property in the returned DTO causes an error when serializing.
System.Runtime.Serialization.SerializationException
HResult=0x8013150C
Message=ODataResourceSerializer cannot write an object of type 'Collection(Edm.Int32)'.
Source=Microsoft.AspNetCore.OData
StackTrace:
at Microsoft.AspNetCore.OData.Formatter.Serialization.ODataResourceSerializer.GetResourceType(Object graph, ODataSerializerContext writeContext) in D:\a_work\1\s\src\Microsoft.AspNetCore.OData\Formatter\Serialization\ODataResourceSerializer.cs:line 1873
Reproduce steps
Just add a int[][] property in the returned object
Data Model
public sealed class PlaneDto
{
public Guid Id { get; set; }
public double[]? Normal { get; set; }
public double[]? Point { get; set; }
public double[]? Points { get; set; }
public int[][]? Contours { get; set; }
}
Assemblies affected
ASP.NET Core OData 8.2.7
Describe the bug
Having a int[][] property in the returned DTO causes an error when serializing.
System.Runtime.Serialization.SerializationException
HResult=0x8013150C
Message=ODataResourceSerializer cannot write an object of type 'Collection(Edm.Int32)'.
Source=Microsoft.AspNetCore.OData
StackTrace:
at Microsoft.AspNetCore.OData.Formatter.Serialization.ODataResourceSerializer.GetResourceType(Object graph, ODataSerializerContext writeContext) in D:\a_work\1\s\src\Microsoft.AspNetCore.OData\Formatter\Serialization\ODataResourceSerializer.cs:line 1873
Reproduce steps
Just add a int[][] property in the returned object
Data Model
public sealed class PlaneDto
{
public Guid Id { get; set; }
public double[]? Normal { get; set; }
public double[]? Point { get; set; }
public double[]? Points { get; set; }
public int[][]? Contours { get; set; }
}
EDM (CSDL) Model
Request/Response
No response.
Expected behavior
A JSON object structured like:
{
"@odata.type": "#Dtos.Data.PlaneDto",
"id": "07dce6fe-ff12-4a88-86ae-2d8bb552088f",
"normal": [ -0.99999999974639, 8.22496291971287E-06, 2.09659328342425E-05 ],
"point": [ -22.4877607468324, 0.000184960998336979, 0.000471476881530173 ],
"points": [
-22.4822136189295,
-13.6948240459868,
269.9512,
-22.4820373695539,
7.7337680567001,
269.9512,
-22.4820382114908,
7.72519531946929,
269.914405720526,
-22.4820924772204,
3.43135458418128,
269.010603875648,
-22.482096711542,
3.14035286630288,
268.922802234785,
-22.4821017805847,
2.8683067344908,
268.78775108443
],
"contours": [
[ 1, 2, 3 ],
[ 2, 3, 4 ]
]
}
Screenshots
If applicable, add screenshots to help explain your problem.
Additional context
The text was updated successfully, but these errors were encountered: