Skip to content

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

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

Activity

  1. added
    test-enhancement
    linkable-framework
    on May 28, 2021
  2. ghost added
    untriaged
    on May 28, 2021
  3. added this to the 6.0.0 milestone on May 28, 2021
  4. removed
    untriaged
    on May 28, 2021
  5. modified the milestones: 6.0.0, 7.0.0 on Aug 9, 2021
  6. eiriktsarpalis commented on Aug 9, 2021

    @eiriktsarpalis
    Member

    Test enhancement, moving to 7.0.0.

  7. added
    source-generator
    on Sep 22, 2021
  8. modified the milestones: 7.0.0, Future on Jul 9, 2022
  9. eiriktsarpalis commented on Jun 7, 2023

    @eiriktsarpalis
    Member

    I believe this has been superseded by recent work.

  10. ghost locked as resolved and limited conversation to collaborators on Jul 8, 2023
  11. MichalStrehovsky commented on Apr 24, 2024

    @MichalStrehovsky
    Member

    I believe this has been superseded by recent work.

    The trimming tests are not using the source generator.

  12. unlocked this conversation on Apr 24, 2024
  13. added
    in-pr
    on Sep 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area-System.Text.Jsonin-prlinkable-frameworksource-generatortest-enhancement

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions