Skip to content

SrcGen fast-path serialization for nullable structs (#59719) - #60366

Closed
SkiFoD wants to merge 1 commit into
dotnet:mainfrom
SkiFoD:skifod/issue-59719
Closed

SrcGen fast-path serialization for nullable structs (#59719)#60366
SkiFoD wants to merge 1 commit into
dotnet:mainfrom
SkiFoD:skifod/issue-59719

Conversation

@SkiFoD

Copy link
Copy Markdown
Contributor

No description provided.

@ghostghost added area-System.Text.Json new-api-needs-documentation community-contribution Indicates that the PR has been added by a community member labels Oct 13, 2021
@ghost

Copy link
Copy Markdown

Note regarding the new-api-needs-documentation label:

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.

@ghost

Copy link
Copy Markdown

Tagging subscribers to this area: @dotnet/area-system-text-json
See info in area-owners.md if you want to be subscribed.

Issue Details

null

Author:SkiFoD
Assignees:-
Labels:

area-System.Text.Json, new-api-needs-documentation, community-contribution

Milestone:-

@SkiFoDSkiFoD changed the title Src-Gen serialization for nullable structs (#59719)SrcGen fast-path serialization for nullable structs (#59719)Oct 13, 2021
@eiriktsarpalis

Copy link
Copy Markdown
Member

Fixes #59719.

@layomia

Copy link
Copy Markdown
Contributor

Thanks for the PR and effort here @SkiFoD. Upon further investigation, it turns out that these changes are not needed because fast-path methods for underlying nullable types are already being invoked when serializing parent nullable types. The pattern for this fast-path execution remains the same:

PersonStruct?person=new(){FirstName="Jane",LastName="Doe"};stringjson=JsonSerializer.Serialize(person,someContext.NullablePersonStruct);// Fast-path for person struct is invoked.

I added tests verifying this behavior here - #61711.

@layomialayomia closed this Nov 17, 2021
@ghostghost locked as resolved and limited conversation to collaborators Dec 17, 2021
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-System.Text.Jsoncommunity-contributionIndicates that the PR has been added by a community membernew-api-needs-documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@SkiFoD@eiriktsarpalis@layomia