-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Closed
Labels
area-System.Text.JsonenhancementProduct code improvement that does NOT require public API changes/additionsProduct code improvement that does NOT require public API changes/additionssource-generatorIndicates an issue with a source generator featureIndicates an issue with a source generator feature
Milestone
Description
As shipped the JsonConstructorAttribute is limited to public constructors only and JsonIncludeAttribute only works with public properties in which either the getter or setter is non-public but not with fields. These annotations can only be scoped to individual members and we've received customer feedback indicating confusion whenever the serializer is not honoring an explicit instruction made by the user.
This issue tracks extending support for these attributes so that user intentions are always honored, where possible. More specifically, it proposes that we:
- Extend
JsonConstructorAttributesupport to internal constructors. (Json serializer code generator doesn't support internal constructors #77016) - Extend
JsonIncludeAttributesupport to internal properties and fields. - [Optional/TBD] add private member support for both attributes (only possible with the reflection serializer/needs .NET 8 runtime features).
dotMorten
Metadata
Metadata
Assignees
Labels
area-System.Text.JsonenhancementProduct code improvement that does NOT require public API changes/additionsProduct code improvement that does NOT require public API changes/additionssource-generatorIndicates an issue with a source generator featureIndicates an issue with a source generator feature