Repository navigation
Fix broken tests when running Config Schema Generator on .NET 9 - #6312
Eric Erhardt (eerhardt) merged 9 commits into
Conversation
|
Hello Bart Koelman (@bart-vmware), thanks for the contribution. This PR is currently set to target release/9.0-rc.1 which is no longer an active branch. Assuming you are okay with me re-targeting it against |
|
Jose Perez Rodriguez (@joperezr) It probably won't work with Can I update this PR to make it compatible with |
|
We are pretty locked down at this point for release/9.0 branch, so unfortunately wouldn't be able to take this into there. |
|
Given the above, I'm retargeting this to go against main as the rc.1 branch is frozen anyway. |
|
(Sorry for the late response. We were busy locking down for .NET Aspire 9.0, which will be released next week.) |
Instead, always use System.Text.Json v9, even on net8.0.
|
Thanks for the PR here Bart Koelman (@bart-vmware). I've pushed some updates to make this ready for review. I took your suggestion of always using System.Text.Json |
…rator.csproj Co-authored-by: Eric Erhardt <eric.erhardt@microsoft.com>
…d Microsoft.Extensions.Hosting v8.0.1
|
Eric Erhardt (@eerhardt) Thanks for doing the updates, this is basically what I had in mind, so LGTM from me. I've renamed |
Eirik Tsarpalis (eiriktsarpalis)
left a comment
There was a problem hiding this comment.
Thanks
| { | ||
| // In System.Text.Json v9, the casing of the new key is not adapted. See https://github.com/dotnet/runtime/issues/108790. | ||
| // So instead, remove the existing node and insert a new one with the updated key. | ||
| var index = jsonObject.IndexOf(key); |
There was a problem hiding this comment.
This workaround requires dual lookup if the key is missing, which suggests to me that a JsonObject.TryAddmethod similar to the one in dotnet/runtime#107947 might be necessary.
|
Is this PR ready to be merged? |
The Microsoft.Extensions.Hosting version used should be based on TFM.
Eric Erhardt (eerhardt)
left a comment
There was a problem hiding this comment.
LGTM.
Thanks for the contribution Bart Koelman (@bart-vmware)!

Description
Adapt the Config Schema Generator logic to deal with the breaking change in
System.Text.Jsonv9, reported at dotnet/runtime#108790.More specifically, this PR fixes the
JsonNodehandling inside Config Schema Generator to work with STJ v9. The generator project still targets .NET 8, but now references STJ v9 explicitly. Its test project now multi-targets against .NET 8 and 9.Before this PR, the generator and its tests only ran on .NET 8 (referencing STJ v8), which is why there were no test failures.
Checklist
<remarks />and<code />elements on your triple slash comments?/cc Eric Erhardt (@eerhardt)
Microsoft Reviewers: Open in CodeFlow