[Analyzer] Update BindMemberAnalyzer to also consider properties of base classes#9160
Merged
tobias-tengler merged 1 commit intomainfrom Feb 19, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the BindMemberAnalyzer to correctly handle members inherited from base classes. Previously, the analyzer would incorrectly report an error when using [BindMember] to reference a property that exists in a base class but not directly on the derived class.
Changes:
- Added
HasMemberhelper method that walks the base type hierarchy to check for member existence - Updated
ValidateMemberExiststo use the new helper instead of only checking the immediate type - Added two new test cases to verify the fix works with both
nameof()and string literal syntax
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
src/HotChocolate/Core/src/Types.Analyzers/BindMemberAnalyzer.cs |
Refactored member existence check to walk base class hierarchy using new HasMember helper method |
src/HotChocolate/Core/test/Types.Analyzers.Tests/BindMemberAnalyzerTests.cs |
Added two test cases for inherited members: one using nameof() and one using string literal |
src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/BindMemberAnalyzerTests.BindMember_WithNameof_InheritedMember_NoError.md |
Snapshot file showing expected generated code for nameof() test |
src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/BindMemberAnalyzerTests.BindMember_WithString_InheritedMember_NoError.md |
Snapshot file showing expected generated code for string literal test |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Contributor
Fusion Gateway Performance ResultsSimple Composite Query
Response Times & Query
query TestQuery {
topProducts(first: 5) {
inStock
name
price
shippingEstimate
upc
weight
reviews {
id
body
author {
id
username
name
}
}
}
}Deep Recursion Query
Response Times & Query
query TestQuery {
users {
id
username
name
reviews {
id
body
product {
inStock
name
price
shippingEstimate
upc
weight
reviews {
id
body
author {
id
username
name
reviews {
id
body
product {
inStock
name
price
shippingEstimate
upc
weight
}
}
}
}
}
}
}
topProducts(first: 5) {
inStock
name
price
shippingEstimate
upc
weight
reviews {
id
body
author {
id
username
name
reviews {
id
body
product {
inStock
name
price
shippingEstimate
upc
weight
}
}
}
}
}
}Variable Batching Throughput
Response Times & Query
query TestQuery($upc: ID!, $price: Long!, $weight: Long!) {
productByUpc(upc: $upc) {
inStock
shippingEstimate(weight: $weight, price: $price)
}
}Variables (5 sets batched per request) [
{ "upc": "1", "price": 899, "weight": 100 },
{ "upc": "2", "price": 1299, "weight": 1000 },
{ "upc": "3", "price": 15, "weight": 20 },
{ "upc": "4", "price": 499, "weight": 100 },
{ "upc": "5", "price": 1299, "weight": 1000 }
]Run 22191073326 • Commit bcd5b12 • Thu, 19 Feb 2026 17:14:00 GMT |
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.
No description provided.