Prevent Dock JSON source-generation context collisions - #1110
Prevent Dock JSON source-generation context collisions#1110wieslawsoltes wants to merge 3 commits into
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 635dee0afd
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3b1ba704b3
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Summary
DockSystemTextJsonContext.*JsonSerializerContextartifacts to the SDK generatorRoot cause
Dock runs the System.Text.Json generator internally to materialize metadata for its generated context. That nested run sees every
JsonSerializerContextin the consumer compilation, and Dock previously republished every resulting artifact. The SDK generator also publishes the application contexts during the normal build, so their partial members and generated attributes were emitted twice.Impact
Consumers can combine
[assembly: DockJsonSourceGeneration]with one or more applicationJsonSerializerContextclasses. Dock continues to emit its own metadata context, while application contexts retain their normal SDK-generated APIs.Generator pipeline
The semantic input remains the complete consumer compilation so Dock types resolve normally. The per-context emission boundary now filters the nested generator result by Dock's stable context hint-name prefix; shared resolver generation is unchanged. This keeps output ownership deterministic without altering discovery or runtime behavior.
Validation
dotnet test tests/Dock.Serializer.SystemTextJson.SourceGenTests/Dock.Serializer.SystemTextJson.SourceGenTests.csproj --filter FullyQualifiedName~DockGenerator_CoexistsWithApplicationJsonContexts --no-restore -maxcpucount:1(1 passed)dotnet test tests/Dock.Serializer.SystemTextJson.Generators.UnitTests/Dock.Serializer.SystemTextJson.Generators.UnitTests.csproj --no-restore -maxcpucount:1(8 passed)dotnet test tests/Dock.Serializer.SystemTextJson.SourceGenTests/Dock.Serializer.SystemTextJson.SourceGenTests.csproj --no-build --no-restore -maxcpucount:1(13 passed)dotnet build samples/DockSystemTextJsonSourceGenAotSample/DockSystemTextJsonSourceGenAotSample.csproj --no-restore -maxcpucount:1(succeeded)System.Text.Json.SourceGeneration; Dock output contains onlyDockSystemTextJsonContext.*git diff --checkFixes #1085