-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Setting RequiredMemberAttribute usage as inherited. #89418
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
Setting RequiredMemberAttribute usage as inherited. #89418
Conversation
|
Note regarding the This serves as a reminder for when your PR is modifying a ref *.cs file and adding/modifying public APIs, 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 DetailsTrying to fix #86031
|
eiriktsarpalis
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please see #86031 (comment). This is not an issue with how the attribute itself is defined (it works as expected in the case of source gen) but rather it is a bug in the reflection resolver.
b40f59c to
d1c4cfa
Compare
@eiriktsarpalis , thanks. Fixed by the proposed way |
...Text.Json/src/System/Text/Json/Serialization/Metadata/DefaultJsonTypeInfoResolver.Helpers.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Text.Json/tests/Common/RequiredKeywordTests.cs
Outdated
Show resolved
Hide resolved
d1c4cfa to
276c4fb
Compare
...Text.Json/src/System/Text/Json/Serialization/Metadata/DefaultJsonTypeInfoResolver.Helpers.cs
Outdated
Show resolved
Hide resolved
| bool shouldCheckMembersForRequiredMemberAttribute | ||
| = !constructorHasSetsRequiredMembersAttribute && currentType.HasRequiredMemberAttribute(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| bool shouldCheckMembersForRequiredMemberAttribute | |
| = !constructorHasSetsRequiredMembersAttribute && currentType.HasRequiredMemberAttribute(); | |
| bool shouldCheckMembersForRequiredMemberAttribute = !constructorHasSetsRequiredMembersAttribute && currentType.HasRequiredMemberAttribute(); |
...Text.Json/src/System/Text/Json/Serialization/Metadata/DefaultJsonTypeInfoResolver.Helpers.cs
Show resolved
Hide resolved
...Text.Json/src/System/Text/Json/Serialization/Metadata/DefaultJsonTypeInfoResolver.Helpers.cs
Show resolved
Hide resolved
src/libraries/System.Text.Json/tests/Common/RequiredKeywordTests.cs
Outdated
Show resolved
Hide resolved
...ests/System.Text.Json.SourceGeneration.Tests/System.Text.Json.SourceGeneration.Tests.targets
Outdated
Show resolved
Hide resolved
...ests/System.Text.Json.SourceGeneration.Tests/System.Text.Json.SourceGeneration.Tests.targets
Outdated
Show resolved
Hide resolved
…neration.Tests/System.Text.Json.SourceGeneration.Tests.targets
eiriktsarpalis
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great, thank you for the contribution!
...Text.Json/src/System/Text/Json/Serialization/Metadata/DefaultJsonTypeInfoResolver.Helpers.cs
Outdated
Show resolved
Hide resolved
…ion/Metadata/DefaultJsonTypeInfoResolver.Helpers.cs
Trying to fix #86031