Skip to content

Remove Roslyn-Reflection helper abstraction from System.Text.Json source generator #79533

Closed

Description

@layomia

This issue refers to the helpers here: https://github.com/dotnet/runtime/tree/5a5ab5962e20d10718b326dda56dfc9285be9acf/src/libraries/System.Text.Json/gen/Reflection.

These helpers provide a conversion from Roslyn metadata to Reflection metadata. They predated the JSON generator (developed by @davidfowl), and were copied into the initial version of the source generator for the following reasons:

  • The developers were more familiar with Reflection APIs and could make progress more expeditiously with the abstraction
  • There was an expectation that there would be a non-trivial amount of Reflection-based code shared between the source-generator and reflection-based implementations of JsonSerializer.

Both reasons no longer hold. The amount/utility of the code shared between the implementations does not justify the additional complexity to maintain the abstraction. There's no good reason to not read the metadata from Roslyn APIs directly.

Activity

  1. added
    source-generator
    on Dec 12, 2022
  2. added this to the 8.0.0 milestone on Dec 12, 2022
  3. eiriktsarpalis commented on Dec 12, 2022

    @eiriktsarpalis
    Member

    This would effectively require rewriting the source generator. Not saying we shouldn't do it, but is it something we could budget for in 8.0.0?

  4. layomia commented on Dec 12, 2022

    @layomia
    ContributorAuthor

    Likely not tbh. I'm fine with making this "future".

  5. modified the milestones: 8.0.0, Future on Dec 12, 2022
  6. ghost added
    in-pr
    on May 16, 2023
  7. ghost removed
    in-pr
    on May 18, 2023
  8. ghost locked as resolved and limited conversation to collaborators on Jun 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-System.Text.Jsonsource-generator

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions