OData / OData/AspNetCoreOData

.NET6 / OData 8 not serializing OData responses properly

Open
#424 5 comments 0 reactions 2 assignees View on GitHub

@gathogojr is already working on this.

Since Jan 11, 2022.

bug P2 regression
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):

Uexpected End

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.

Breaks Here

Hoping this now helps you guys find and fix the issue.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.