Skip to content

Handle parameterless ctors in structs in STJ's ReflectionEmitMemberAccessor - #62989

Merged
krwq merged 5 commits into
dotnet:mainfrom
EgorBo:fix-json-deserialize-structs-ctor
Dec 21, 2021
Merged

Handle parameterless ctors in structs in STJ's ReflectionEmitMemberAccessor #62989
krwq merged 5 commits into
dotnet:mainfrom
EgorBo:fix-json-deserialize-structs-ctor

Conversation

@EgorBo

Copy link
Copy Markdown
Member

Fixes#62983

I assume the bugfix needs backporting to 6.0?

@ghostghost assigned EgorBoDec 18, 2021
@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

Fixes #62983

I assume the bugfix needs backporting to 6.0?

Author:EgorBo
Assignees:-
Labels:

area-System.Text.Json

Milestone:-


public struct StructWithPropertyInit
{
public long A { get; set; } = 42;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

consider for completeness one more test where you explicitly set this to something else (i.e. 43) in the JSON and make sure this got respected

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added!

@krwqkrwq left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with optional suggestion

@krwq
krwq merged commit 9a50493 into dotnet:mainDec 21, 2021
@ghostghost locked as resolved and limited conversation to collaborators Jan 20, 2022
@EgorBo

Copy link
Copy Markdown
MemberAuthor

/backport to release/6.0

@EgorBo
EgorBo deleted the fix-json-deserialize-structs-ctor branch April 12, 2022 11:33
@EgorBo
EgorBo restored the fix-json-deserialize-structs-ctor branch April 12, 2022 11:33
@dotnetdotnet unlocked this conversation Apr 12, 2022
@EgorBo

Copy link
Copy Markdown
MemberAuthor

/backport to release/6.0

@github-actions

Copy link
Copy Markdown
Contributor

Started backporting to release/6.0: https://github.com/dotnet/runtime/actions/runs/2154658059

@github-actions

Copy link
Copy Markdown
Contributor

@EgorBo an error occurred while backporting to release/6.0, please check the run log for details!

Error: @EgorBo is not a repo collaborator, backporting is not allowed. If you're a collaborator please make sure your Microsoft team membership visibility is set to Public on https://github.com/orgs/microsoft/people?query=EgorBo

@EgorBo

Copy link
Copy Markdown
MemberAuthor

/backport to release/6.0

@github-actions

Copy link
Copy Markdown
Contributor

Started backporting to release/6.0: https://github.com/dotnet/runtime/actions/runs/2154672050

@github-actions

Copy link
Copy Markdown
Contributor

@EgorBo an error occurred while backporting to release/6.0, please check the run log for details!

Error: @EgorBo is not a repo collaborator, backporting is not allowed. If you're a collaborator please make sure your Microsoft team membership visibility is set to Public on https://github.com/orgs/microsoft/people?query=EgorBo

eiriktsarpalis pushed a commit to EgorBo/runtime-1 that referenced this pull request May 4, 2022
carlossanlop pushed a commit that referenced this pull request May 4, 2022
…onEmitMemberAccessor (#67901)
* [release/6.0] backport #62989 "Handle parameterless ctors in structs in STJ's ReflectionEmitMemberAccessor"
* Add explicit parameterless constructors in the tests
* Update ConstructorTests.ParameterMatching.cs
* address feedback
Co-authored-by: Eirik Tsarpalis <eirik.tsarpalis@gmail.com>
@ghostghost locked as resolved and limited conversation to collaborators May 12, 2022
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

JsonSerializer throws AccessViolationException for struct with field initializers

4 participants

@EgorBo@krwq@jkotas@layomia