-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Open
Labels
area-System.Text.Jsonpartner-impactThis issue impacts a partner who needs to be kept updatedThis issue impacts a partner who needs to be kept updatedsize-reductionIssues impacting final app size primary for size sensitive workloadsIssues impacting final app size primary for size sensitive workloads
Milestone
Description
The PR in #80755 attempted to reduce the size of System.Text.Json components in trimmed NativeAOT binaries. The per-namespace breakdown in #80755 (comment) shows that there might be opportunity to further reduce application size in the System.Text.Json.Serialization.Metadata namespace, which currently occupies approximately 600k in the Golidlocks app. More specifically, the metadata layer introduces overhead in a couple of ways:
- Using separate
JsonTypeInfo<T>implementations for source gen and reflection. This segregation largely exists for historical reasons and it could be removed, decouplingJsonTypeInfo<T>metadata from contract resolution behavior. - The source generator sets
JsonTypeInfometadata using theJsonMetadataServicesAPIs as a proxy. This happens because the source generator predates the public APIs onJsonTypeInfoitself. The proxy API introduces a number of generic classes such asJsonCollectionInfoValues<T>,JsonObjectInfoValues<T>andJsonPropertyInfoValues<T>. All these types could be trimmed if we updated the source generator to call into theJsonTypeInfoAPIs directly. Note that this is currently blocked by Add support for parameterized constructors in System.Text.Json contract customization (converters) #71944, the only remaining configuration point available inJsonMetadataServicesbut not yet present inJsonTypeInfo<T>.
krwq, eerhardt, rogihee and PaulusParssinen
Metadata
Metadata
Assignees
Labels
area-System.Text.Jsonpartner-impactThis issue impacts a partner who needs to be kept updatedThis issue impacts a partner who needs to be kept updatedsize-reductionIssues impacting final app size primary for size sensitive workloadsIssues impacting final app size primary for size sensitive workloads