-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
JsonSerializerOptions.Web
for JsonSerializerOptions
#94370
Conversation
Note regarding the This serves as a reminder for when your PR is modifying a ref *.cs file and adding/modifying public APIs, please make sure the API implementation in the src *.cs file is documented with triple slash comments, so the PR reviewers can sign off that change. |
Tagging subscribers to this area: @dotnet/area-system-text-json, @gregsdennis Issue Detailsnull
|
src/libraries/System.Text.Json/src/System/Text/Json/Serialization/JsonSerializerOptions.cs
Outdated
Show resolved
Hide resolved
JsonSerializerOptions.Web
for JsonSerializerOptions
May i change all statement in dontent/runtime |
src/libraries/System.Text.Json/src/System/Text/Json/Serialization/JsonSerializerOptions.cs
Outdated
Show resolved
Hide resolved
Yes, where possible, but most of these cases would involve removing the static readonly field entirely and just changing call sites to use the new property directly. |
@@ -1253,7 +1253,7 @@ public static void DefaultSerializerOptions_General() | |||
[Fact] | |||
public static void PredefinedSerializerOptions_Web() | |||
{ | |||
var options = new JsonSerializerOptions(JsonSerializerDefaults.Web); | |||
var options = JsonSerializerOptions.Web; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test is checking the behavior of the constructor and shouldn't be changed. Consider adding a separate test for the singleton instead.
It depends. Unit tests explicitly there to validate the behavior of the constructor shouldn't be changed, whereas it would be beneficial to update product code that defines its own singletons in lieu of a centrally defined one. |
src/libraries/System.Text.Json/src/System/Text/Json/Serialization/JsonSerializerOptions.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Text.Json/tests/System.Text.Json.Tests/Serialization/OptionsTests.cs
Show resolved
Hide resolved
src/libraries/System.Text.Json/src/System/Text/Json/Serialization/JsonSerializerOptions.cs
Outdated
Show resolved
Hide resolved
@I-SER-I would it be possible to address the feedback when possible? Thanks! |
…th JsonSerializerDefaults and add tests
adf3c1e
to
0d679d0
Compare
Close #92181