-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
[JSON source gen 2/3] Add JSON source generator #51300
Conversation
Note regarding the This serves as a reminder for when your PR is modifying a ref *.cs file and adding/modifying public APIs, to please make sure the API implementation in the src *.cs file is documented with triple slash comments, so the PR reviewers can sign off that change. |
Tagging subscribers to this area: @eiriktsarpalis, @layomia Issue DetailsContributes to #45448. Still WIP but ready for a first look.
|
src/libraries/System.Text.Json/source_generation/src/JsonSerializableSyntaxReceiver.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Text.Json/tests/Serialization/OptionsTests.cs
Outdated
Show resolved
Hide resolved
...ibraries/System.Text.Json/src/System/Text/Json/Serialization/Metadata/JsonPropertyInfoOfT.cs
Show resolved
Hide resolved
...ries/System.Text.Json/src/System/Text/Json/Serialization/JsonSerializerOptions.Converters.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Text.Json/source_generation/src/System.Text.Json.SourceGeneration.csproj
Outdated
Show resolved
Hide resolved
src/libraries/System.Text.Json/source_generation/src/JsonSourceGeneratorHelper.Generate.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Text.Json/source_generation/src/JsonSourceGenerator.cs
Outdated
Show resolved
Hide resolved
e8c34bc
to
305aa9a
Compare
src/libraries/System.Text.Json/source_generation/src/JsonSourceGeneratorHelper.Generate.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Text.Json/source_generation/src/JsonSourceGeneratorHelper.Generate.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Text.Json/source_generation/src/JsonSourceGeneratorHelper.Generate.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Text.Json/source_generation/src/JsonSourceGeneratorHelper.Generate.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Text.Json/source_generation/src/JsonSourceGeneratorHelper.Generate.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Text.Json/source_generation/src/JsonSourceGeneratorHelper.Generate.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Text.Json/source_generation/src/JsonSourceGeneratorHelper.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Text.Json/source_generation/src/JsonSourceGeneratorHelper.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Text.Json/source_generation/src/JsonSourceGeneratorHelper.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Text.Json/source_generation/src/JsonSourceGeneratorHelper.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Text.Json/source_generation/src/ReflectionUtils/MetadataLoadContext.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Text.Json/source_generation/src/ReflectionUtils/AssemblyWrapper.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Text.Json/source_generation/src/JsonSourceGeneratorHelper.Generate.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Text.Json/source_generation/src/System.Text.Json.SourceGeneration.csproj
Outdated
Show resolved
Hide resolved
src/libraries/System.Text.Json/source_generation/src/JsonSourceGenerator.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Text.Json/source_generation/src/JsonSourceGenerator.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Text.Json/source_generation/src/System.Text.Json.SourceGeneration.csproj
Outdated
Show resolved
Hide resolved
Here are the remaining items I plan to address for preview 4 in follow-up PRs
Other work items I'm tracking for post-preview 4: |
Thanks folks for the review. I'm still addressing feedback. I'll merge it when it's ready and go to Tactics / back-port to preview 4. |
src/libraries/System.Text.Json/gen/src/System.Text.Json.SourceGeneration.csproj
Outdated
Show resolved
Hide resolved
public MetadataLoadContextInternal(Compilation compilation) | ||
{ | ||
_compilation = compilation; | ||
Dictionary<AssemblyName, IAssemblySymbol> assemblies = compilation.References |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you see any major performance regression since this happens every build?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I really haven't done much build-time throughput testing, but [really] early code-gen perf numbers suggested the build time isn't increasing by a crazy amount. Do you know of a reliable way to measure the perf here that doesn't include noise from other parts of the compilation?
I've taken a note to optimize the generator's implementation (e.g. looking at caching where possible), and also to adopt the incremental source generator pattern being designed.
Kudos for no less than 7 reviewers working together here to help @layomia get this over the finish line for the preview. |
4d74f24
to
5d41b58
Compare
Hello @layomia! Because this pull request has the p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (
|
/backport to release/6.0-preview4 |
Started backporting to release/6.0-preview4: https://github.com/dotnet/runtime/actions/runs/764610593 |
FYI @tdykstra - I'll address any feedback you have in a follow up. Thanks! |
Contributes to #45448.
PR 1 - #51149
PR 2 - this PR
PR 3 - #51528