-
Notifications
You must be signed in to change notification settings - Fork 5k
Add [JsonConstructor] and support for deserializing with parameterized ctors #33444
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
Conversation
Note regarding the This serves as a reminder for when your PR is modifying a ref *.cs file and adding/modifying public APIs, to 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. |
Does this degrade perf on the existing benchmarks? |
...tem.Text.Json/src/System/Text/Json/Serialization/Converters/Object/ObjectConverterFactory.cs
Outdated
Show resolved
Hide resolved
...tem.Text.Json/src/System/Text/Json/Serialization/Converters/Object/ObjectConverterFactory.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Text.Json/tests/Serialization/TestClasses.Constructor.cs
Show resolved
Hide resolved
src/libraries/System.Text.Json/tests/Serialization/Object.ReadTests.cs
Outdated
Show resolved
Hide resolved
...Json/Serialization/Converters/Object/ObjectWithParameterizedConstructorConverter.ReadJson.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Text.Json/src/System/Text/Json/Serialization/JsonClassInfo.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Text.Json/src/System/Text/Json/Serialization/JsonParameterInfo.cs
Show resolved
Hide resolved
src/libraries/System.Text.Json/src/System/Text/Json/Serialization/JsonClassInfo.cs
Show resolved
Hide resolved
src/libraries/System.Text.Json/src/System/Text/Json/Serialization/ReadStackFrame.cs
Outdated
Show resolved
Hide resolved
Perf results for existing benchmarks:
|
|
src/libraries/System.Text.Json/src/System/Text/Json/Serialization/ConstructorArgumentState.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Text.Json/src/System/Text/Json/Serialization/ConstructorArgumentState.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Text.Json/src/System/Text/Json/Serialization/ConstructorArgumentState.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Text.Json/tests/Serialization/DeserializationWrapper.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Text.Json/tests/Serialization/ConstructorTests.Stream.cs
Outdated
Show resolved
Hide resolved
Test failure unrelated - System.Xml.RW.XmlConvert.Tests. |
Fixes #29895.
Implements specification in #33095.
Performance notes
Benchmarks: dotnet/performance#1233.
TLDR
IndexViewModel
andMyEventListerViewModel
benchmarks). There's also a ~300B increase in allocs for these cases. This is due to new state added to theReadStack
to support this feature, and a minimal check when pushing/popping stack frames to support fetching ctor arg state on continuation and/or scenarios involving nested objects with parameterized ctors.