dotnet / dotnet/fsharp

Json parsing with struct and attributes changed from net6 to net7

Open
#14,858 13 comments 0 reactions 1 assignee Claimed by @T-Gro View on GitHub
Bug Impact-High Regression Tracking-External
Dominant language
F#
Stars
4.3k
Forks
876
Avg merge
4d 11h
Merged PRs (30d)
131

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](https://github.com/dotnet/fsharp/files/10907152/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\

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.