Repository navigation
Fix source-generated batch resolvers with a keyed service not compiling - #10442
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
No unresolved issues were identified that would block approval.
Review effort: Lite
Findings: None
What changed in this PR
Fixes source-generated batch resolvers with keyed services by emitting preformatted service keys correctly.
Changes:
- Removes duplicate quoting in batch resolver generation.
- Adds a keyed-service regression snapshot test.
- Updates the expected generated source snapshot.
| File | Description |
|---|---|
| src/HotChocolate/Core/test/Types.Analyzers.Tests/ObjectTypeTests.cs | Updated as part of this pull request. |
| src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ObjectTypeTests.BatchResolver_With_KeyedService_MatchesSnapshot.md | Updated as part of this pull request. |
| src/HotChocolate/Core/src/Types.Analyzers/FileBuilders/TypeFileBuilderBase.cs | Updated as part of this pull request. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Contributor
Patch coverage100.0% of changed lines covered (1/1)
Project coverage: 58.8% (298893/508115 lines) |
This was referenced Oct 25, 2026
Merged
This was referenced Nov 1, 2026
This was referenced Nov 15, 2026
fix(deps): Bump Basic.Reference.Assemblies.Net100 and 32 others
AdCodicem/AdCodicem.ValueObjects#262
Closed
This was referenced Nov 22, 2026
fix(deps): Bump Basic.Reference.Assemblies.Net100 and 43 others
AdCodicem/AdCodicem.ValueObjects#274
Closed
This was referenced Nov 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
[BatchResolver]with a keyed[Service("greeting")]parameter emittedcontexts[0].Service<T>(""greeting""), which does not compile. The service key reaches the file builder as a formatted C# literal, and the batch path wrapped it in a second pair of quotes. The batch path now emits the literal as-is, the same as the regular resolver path.Test plan
BatchResolver_With_KeyedService_MatchesSnapshot. Its snapshot showsService<GreetingService>("greeting")and no diagnostics. With the fix reverted, the same test fails with CS1003 and CS0103 in the emitted assembly.Types.Analyzers.TestsandTypes.Analyzers.Integration.Testspass on net10.0.