Skip to content
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

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

Open
eerhardt opened this issue May 28, 2021 · 4 comments
Assignees
Labels
area-System.Text.Json linkable-framework Issues associated with delivering a linker friendly framework source-generator Indicates an issue with a source generator feature test-enhancement Improvements of test source code
Milestone

Comments

@eerhardt
Copy link
Member

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

@eerhardt eerhardt added area-System.Text.Json test-enhancement Improvements of test source code linkable-framework Issues associated with delivering a linker friendly framework labels May 28, 2021
@ghost
Copy link

ghost commented May 28, 2021

Tagging subscribers to this area: @eiriktsarpalis, @layomia
See info in area-owners.md if you want to be subscribed.

Issue Details

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

Author: eerhardt
Assignees: -
Labels:

area-System.Text.Json, linkable-framework, test enhancement

Milestone: -

@eiriktsarpalis
Copy link
Member

Test enhancement, moving to 7.0.0.

@layomia layomia added the source-generator Indicates an issue with a source generator feature label Sep 22, 2021
@jeffhandley jeffhandley modified the milestones: 7.0.0, Future Jul 9, 2022
@eiriktsarpalis
Copy link
Member

I believe this has been superseded by recent work.

@ghost ghost locked as resolved and limited conversation to collaborators Jul 8, 2023
@MichalStrehovsky
Copy link
Member

I believe this has been superseded by recent work.

The trimming tests are not using the source generator.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-System.Text.Json linkable-framework Issues associated with delivering a linker friendly framework source-generator Indicates an issue with a source generator feature test-enhancement Improvements of test source code
Projects
None yet
Development

No branches or pull requests

5 participants