Uh oh!
There was an error while loading. Please reload this page.
Extend JsonIncludeAttribute and JsonConstructorAttribute support to internal and private members - #88452
Conversation
ghost
commented
Jul 5, 2023
Tagging subscribers to this area: @dotnet/area-system-text-json, @gregsdennis Issue DetailsThe
This PR changes the semantics of both attributes so that they have uniform behavior regardless of accessibility. It assumes that users know what they're doing when annotating a given member and tries to accommodate their request. A notable exception to this rule is the source generator, which will warn/throw a runtime exception if the user tries to include members that are not accessible to the source generated context. Fix #87431
|
jeffhandley
commented
Jul 6, 2023
Is this an application-runtime exception, or is this a source-generator-runtime exception / application-design-time build error? |
eiriktsarpalis
commented
Jul 6, 2023
It's both -- a diagnostic warning will be emitted at compile time and an exception will be thrown at run time. |
Uh oh!
There was an error while loading. Please reload this page.
eiriktsarpalis
commented
Jul 7, 2023
Test failures are unrelated and tracked by #88453 |
The
JsonIncludeandJsonConstructorattributes are annotations that can be applied directly to individual members to include them in the JSON contract for a specific type. Historically however these attributes haved either:JsonConstructor),JsonIncludeon properties requires that either the getter or setter should be public for the non-public counterpart to be accessed) or,JsonInclude).This PR changes the semantics of both attributes so that they have uniform behavior regardless of accessibility. It assumes that users know what they're doing when annotating a given member and tries to accommodate their request. A notable exception to this rule is the source generator, which will warn/throw a runtime exception if the user tries to include members that are not accessible to the source generated context.
Fix#87431