Skip to content

JsonSerializer trimming tests should be re-written to use the source generator #53437

@eerhardt

Description

@eerhardt

The JsonSerializer is not trim-compatible when not using the JSON source generator (see #51886). However, we have a bunch of "trimming tests" that used it in a trimmed app, but only for one level of objects (like just one Hashtable or Queue<T>).

I am removing a bunch of these tests while working on #52268 and #53256 because they no longer pass after these issues are resolved.

However, supporting these scenarios in a trimmed app is important. The trim-compatible way to use JsonSerializer is to use the JSON source generator, and pass in the generated JsonTypeInfo<T> to the JsonSerializer.

We should re-do these trimming tests to use the JSON source generator and add them back. However, this can't happen until the JSON source generator supports all the collection types that the JsonSerializer supports (#53393).

This issue is to track bringing all these trimming tests using the JSON source generator.

cc @layomia

Metadata

Metadata

Assignees

Labels

area-System.Text.Jsonlinkable-frameworkIssues associated with delivering a linker friendly frameworksource-generatorIndicates an issue with a source generator featuretest-enhancementImprovements of test source code

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions