.NET6 / OData 8 not serializing OData responses properly
@gathogojr is already working on this.
Since Jan 11, 2022.
- Dominant language
- C#
- Stars
- 505
- Forks
- 186
- PR merge metrics
- No merged PRs in 30d
Description
I originally opened this issue in the WebApi repo (not realizing there's this new repo specifically for .NET Core).. The full details of the issue can be found here:
https://github.com/OData/WebApi/issues/2602
But basically I am seeing this error in .NET 6 (where everything was fine in .NET 5):
I guess the guy who was going to look into it got busy, so I decided to look into this further myself by debugging with your source code.. and I've discovered that this issue happens when one of the properties is an object[]. In my case:
public object[] KeyValues
{
get { return new object[] { Id }; }
}
There seems to be an error happening in Microsoft.AspNetCore.OData.Formatter.Serialization.CreateStructuralPropertyBag() for that one property. No error message thrown.. it just breaks right where it was silently and I get a broken JSON response.

Hoping this now helps you guys find and fix the issue.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.