fix(http-client-csharp): exclude custom constructors with settings parameter from property discovery#10260
Merged
JoshLove-msft merged 4 commits intomicrosoft:mainfrom Apr 3, 2026
Conversation
…ings properties Replace name-based 'settings' filter with type-based check that compares the parameter's resolved type name against the settings type name. This correctly excludes parameters whose type matches the ClientSettings type itself, preventing self-referential Settings properties regardless of parameter naming. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
commit: |
Contributor
|
No changes needing a change description found. |
…eter When discovering custom constructor parameters for ClientSettings properties and ConfigurationSchema.json, skip constructors that have a ClientSettings-typed parameter. These are generated settings constructors (e.g. Client(ClientSettings settings)) that appear in CustomCodeView because Roslyn sees all partial class members. Including their parameters creates a self-referential Settings property on the settings type. Added HasSettingsParameter helper and tests verifying settings types don't contain self-referential properties or bindings. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…eter When discovering custom constructor parameters for ClientSettings properties, BindCore binding, and ConfigurationSchema.json, skip constructors that have a parameter matching the client's settings type. The generated settings constructor (e.g. Client(ClientSettings settings)) is visible through CustomCodeView because Roslyn sees all partial class members. Including its parameter creates a self-referential Settings property on the settings type. The fix checks parameter type equality against ClientProvider.ClientSettings.Type rather than using name-based heuristics. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
ArcturusZhang
approved these changes
Apr 3, 2026
jsquire
approved these changes
Apr 3, 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.
Problem
When building settings properties from custom constructors, we consider all public constructors on the client. If a custom constructor takes the client's settings type as a parameter, it doesn't make sense to consider that constructor — the settings type is the thing we're building, so its constructor parameters aren't meaningful inputs for configuration binding.
Fix
Skip custom constructors that have a parameter whose type matches \ClientProvider.ClientSettings.Type\ when discovering parameters for settings properties, \BindCore\ bindings, and \ConfigurationSchema.json\ generation.