Add DateOnly and TimeOnly support to System.Text.Json#69160
Add DateOnly and TimeOnly support to System.Text.Json#69160eiriktsarpalis merged 4 commits intodotnet:mainfrom
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. |
|
Tagging subscribers to this area: @dotnet/area-system-text-json, @gregsdennis Issue DetailsFix #53539.
|
|
@eiriktsarpalis will this address serialization failures when |
Yes, the |
Thank you! That was the piece I was missing. Works great now 😄 |
...es/System.Text.Json/src/System/Text/Json/Serialization/Converters/Value/DateOnlyConverter.cs
Outdated
Show resolved
Hide resolved
...es/System.Text.Json/src/System/Text/Json/Serialization/Converters/Value/DateOnlyConverter.cs
Show resolved
Hide resolved
...es/System.Text.Json/src/System/Text/Json/Serialization/Converters/Value/TimeOnlyConverter.cs
Show resolved
Hide resolved
...ries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Tests/RealWorldContextTests.cs
Show resolved
Hide resolved
...es/System.Text.Json/src/System/Text/Json/Serialization/Converters/Value/DateOnlyConverter.cs
Show resolved
Hide resolved
.../System.Text.Json/tests/System.Text.Json.SourceGeneration.Tests/SerializationContextTests.cs
Show resolved
Hide resolved
...es/System.Text.Json/src/System/Text/Json/Serialization/Converters/Value/TimeOnlyConverter.cs
Show resolved
Hide resolved
...ries/System.Text.Json/src/System/Text/Json/Serialization/JsonSerializerOptions.Converters.cs
Show resolved
Hide resolved
src/libraries/System.Text.Json/src/System/Text/Json/ThrowHelper.cs
Outdated
Show resolved
Hide resolved
…r.cs Co-authored-by: Layomi Akinrinade <layomia@gmail.com>
...tem.Text.Json/src/System/Text/Json/Serialization/Metadata/JsonMetadataServices.Converters.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Tests/ContextClasses.cs
Outdated
Show resolved
Hide resolved
| public int Year; | ||
| public int Month; | ||
| public int Day; | ||
| public bool IsCalendarDateOnly; |
There was a problem hiding this comment.
I don't know if it would help with #69447 (comment), but defining this field here will increase the size of this struct from 40 bytes to 48 bytes on 64-bit. If you instead move this field to the end, the size should stay at 40.
There was a problem hiding this comment.
Not seeing a difference in benchmarks when I rearrange the fields, but I could try pushing the change and see if it registers in the performance infrastructure.
Fix #53539.