Skip to content

Json parsing with struct and attributes changed from net6 to net7 #14858

Open
@JohnnyFasching

Description

I upgraded my application from .net 6 to .net 7, and after the deployment I got problems, because the newtonsoft json parser returned null values, except of the values represented in the json string.

Repro steps

I provided a sample F# script and the json document, where you can see the difference between the two types I created.
The "TokenResponse_net6" type was working fine in .net 6, but not anymore in .net 7

Expected behavior

However when I modify the type like in my "TokenResponse_net7" the values get parsed properly.
It seems that there was a change in the annotations and probably also how the struct works with those

Newtonsoft.Json.zip

.NET SDK:
Version: 7.0.201
Commit: 68f2d7e7a3

Runtime Environment:
OS Name: Windows
OS Version: 10.0.22621
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\7.0.201\

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Labels

BugImpact-High(Internal MS Team use only) Describes an issue with extreme impact on existing code.RegressionTracking-External

Type

Projects

Relationships

None yet

Development

No branches or pull requests

Issue actions