-
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
Implement the JsonSerializer.IsReflectionEnabledByDefault feature switch #83844
Implement the JsonSerializer.IsReflectionEnabledByDefault feature switch #83844
Conversation
Tagging subscribers to this area: @dotnet/area-system-text-json, @gregsdennis Issue DetailsFix #83279. Note that this scales back the scope of the API as approved, since populating a resolver at the default constructor creates usability issues when used in conjunction with var options = new JsonSerializerOptions { TypeInfoResolverChain = { MyContextA.Default, MyContextB.Default } };
Assert.Equal(new [] { DefaultJsonTypeInfoResolver, MyContextA.Default, MyContextB.Default }, options.TypeInfoResolverChain); Instead, this PR simply wires the feature switch to the
|
src/libraries/System.Text.Json/src/System/Text/Json/AppContextSwitchHelper.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Text.Json/src/System/Text/Json/Serialization/JsonSerializerOptions.cs
Show resolved
Hide resolved
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.
LGTM
src/libraries/System.Text.Json/src/System/Text/Json/AppContextSwitchHelper.cs
Show resolved
Hide resolved
src/libraries/System.Text.Json/src/System/Text/Json/AppContextSwitchHelper.cs
Show resolved
Hide resolved
src/libraries/System.Text.Json/src/System/Text/Json/Serialization/JsonSerializerOptions.cs
Show resolved
Hide resolved
src/libraries/System.Text.Json/src/System/Text/Json/Serialization/JsonSerializerOptions.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Text.Json/src/ILLink/ILLink.Substitutions.xml
Outdated
Show resolved
Hide resolved
src/libraries/System.Text.Json/src/System/Text/Json/Serialization/JsonSerializerOptions.cs
Outdated
Show resolved
Hide resolved
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/AppContextSwitchHelper.cs
Show resolved
Hide resolved
src/libraries/System.Text.Json/src/ILLink/ILLink.Substitutions.xml
Outdated
Show resolved
Hide resolved
src/libraries/System.Text.Json/src/ILLink/ILLink.Substitutions.xml
Outdated
Show resolved
Hide resolved
src/libraries/System.Text.Json/tests/System.Text.Json.Tests/Serialization/OptionsTests.cs
Outdated
Show resolved
Hide resolved
ca49b6c
to
cae73ce
Compare
.../System.Text.Json/tests/System.Text.Json.TrimmingTests/System.Text.Json.TrimmingTests.csproj
Outdated
Show resolved
Hide resolved
...libraries/System.Text.Json/tests/System.Text.Json.TrimmingTests/UseReflectionDefaultFalse.cs
Outdated
Show resolved
Hide resolved
...libraries/System.Text.Json/tests/System.Text.Json.TrimmingTests/UseReflectionDefaultFalse.cs
Outdated
Show resolved
Hide resolved
.../System.Text.Json/tests/System.Text.Json.TrimmingTests/System.Text.Json.TrimmingTests.csproj
Outdated
Show resolved
Hide resolved
…eature switch to match namespace.
920da20
to
1d9f86b
Compare
Holding off from merging until the revised API has been approved. |
src/libraries/System.Text.Json/src/System/Text/Json/Serialization/JsonSerializer.Helpers.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Text.Json/src/System/Text/Json/Serialization/JsonSerializer.Helpers.cs
Outdated
Show resolved
Hide resolved
...em.Text.Json/tests/System.Text.Json.Tests/TrimmingTests/IsReflectionEnabledByDefaultFalse.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Text.Json/tests/System.Text.Json.Tests/System.Text.Json.Tests.csproj
Outdated
Show resolved
Hide resolved
…ion/JsonSerializer.Helpers.cs Co-authored-by: Eric Erhardt <eric.erhardt@microsoft.com>
…immingTests/IsReflectionEnabledByDefaultFalse.cs Co-authored-by: Eric Erhardt <eric.erhardt@microsoft.com>
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.
Nice work, @eiriktsarpalis.
LGTM
Adds a msbuild property that ties to the feature switch implemented in dotnet/runtime#83844. Default JsonSerializerIsReflectionEnabledByDefault in ASP.NET PublishAot apps to start the replacement of the ASP.NET JSON feature switch. Co-authored-by: Eric Erhardt <eric.erhardt@microsoft.com>
Fix #83279.