Skip to content
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

Fix support for non-public default constructors using JsonIncludeAttribute #90612

Conversation

eiriktsarpalis
Copy link
Member

@eiriktsarpalis eiriktsarpalis commented Aug 15, 2023

PR #88452 added support for non-public constructors using JsonIncludeAttribute, however it didn't account for default constructors, which use a different path when being populated in the reflection serializer.

Fix #90577

Should be backported to release/8.0-rc1

@eiriktsarpalis
Copy link
Member Author

/backport to release/8.0-rc1

@github-actions
Copy link
Contributor

Started backporting to release/8.0-rc1: https://github.com/dotnet/runtime/actions/runs/5869872173

@ghost
Copy link

ghost commented Aug 15, 2023

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

Issue Details

PR #88452 added support for non-public constructors using JsonIncludeAttribute, however it didn't account for default constructors, which use a different path when being populated in the reflection serializer.

Fix #90577

Should be backported to release/8.0-rc1

Author: eiriktsarpalis
Assignees: eiriktsarpalis
Labels:

area-System.Text.Json

Milestone: 8.0.0

Copy link
Member

@tarekgh tarekgh left a comment

Choose a reason for hiding this comment

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

LGTM!

@eiriktsarpalis eiriktsarpalis merged commit 227e882 into dotnet:main Aug 16, 2023
102 of 105 checks passed
@eiriktsarpalis eiriktsarpalis deleted the fix/json-constructor-nonpublic-default-ctors branch August 16, 2023 05:59
@TanvirArjel
Copy link

TanvirArjel commented Aug 16, 2023

@eiriktsarpalis Title looks misleading. It should be "Fix support for non-public default constructors using JsonConstructorAttribute " isn't it? Please confirm you have made the fix for JsonConstructorAttribute, not JsonIncludeAttribute!

@eiriktsarpalis
Copy link
Member Author

eiriktsarpalis commented Aug 16, 2023

Yes that's a typo, it is in fact addressing the issue with JsonConstructorAttribute. PR has been merged now, so not much can be done. 🤷

@ghost ghost locked as resolved and limited conversation to collaborators Sep 15, 2023
Sign up for free to 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.

JsonConstructorAttribute not working for private/internal ctor in .NET 8.0 preview7
3 participants