Better System.Text.JSON experience in Source Generators
- Dominant language
- C#
- Stars
- 3.2k
- Forks
- 1.3k
- PR merge metrics
- PR metrics pending
Description
The current story for packing transient nuget packages into delivered source generators is generally not great, and makes working with them feel like a second class participant in the dotnet ecosystem. This is incredibly sad, because as an idea they are brilliant and incredibly useful.
[This issue that goes into working with transient nuget packages for generators](https://github.com/dotnet/sdk/issues/17775#issuecomment-2131838313) was filed **_three years ago_** and seems like no work has really been done to make this any better.
I'm making this issue in lieu of waiting for the transient experience to change, and instead suggest that I assume one of the biggest transient nuget packages people include in generators (even as shown in the linked issue) is System.Text.JSON (or Newtonsoft).
Including System.Text.JSON in a delivered nuget source generator, which feels like **an absolutely perfect** use case for System.Text.JSON, is pull-out-you-hair difficult. Given SGs being pinned to netstandard2.0, you _have_ to use a dedicated package
to get that capability. But for above reasons, it doesn't work super well and introduces a lot of other annoying things to do to manage the inclusion of that _singe_ package.
So my question is — can we just get some way of System.Text.JSON inside of a source generator by default? Or have some path for generators to work for netcore apps instead of being pinned to netstandard2.0 (as an opt-in?).
Maybe I'm dreaming here, but this issue feels like it is singlehandlely halting development progress for me on some generators and I'd love to have just a simple answer for "how to do JSON deserialization in a source generator".
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.