Skip to content

Skip parameter binding if ParamemtersObject provided#597

Merged
zhiyuanliang-ms merged 4 commits intomainfrom
linglingye/skip-bind-settings
Apr 23, 2026
Merged

Skip parameter binding if ParamemtersObject provided#597
zhiyuanliang-ms merged 4 commits intomainfrom
linglingye/skip-bind-settings

Conversation

@linglingye001
Copy link
Copy Markdown
Member

@linglingye001 linglingye001 commented Apr 22, 2026

Why this PR?

The BindSettings method wasn't updated to skip when ParametersObject is set — it still calls BindParameters, which fails on empty config.

Visible Changes

Skip bind settings when ParametersObject is set.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates feature filter parameter binding so that when an IFeatureDefinitionProvider supplies a typed ParametersObject, FeatureManager skips IConfiguration-based parameter binding and uses the provided object as-is.

Changes:

  • Skip IFilterParametersBinder.BindParameters(...) when FeatureFilterEvaluationContext.ParametersObject is already provided.
  • Add tests validating ParametersObject support (and invalid-type behavior) for the targeting filter.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/Microsoft.FeatureManagement/FeatureManager.cs Avoids binding settings from IConfiguration when a provider supplies ParametersObject.
tests/Tests.FeatureManagement/FeatureManagementTest.cs Adds coverage ensuring targeting respects ParametersObject and throws on invalid object type.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/Microsoft.FeatureManagement/FeatureManager.cs
@zhiyuanliang-ms zhiyuanliang-ms merged commit 8faed1a into main Apr 23, 2026
5 checks passed
zhiyuanliang-ms added a commit that referenced this pull request Apr 23, 2026
* Remove FeatureFilterEvaluationContext.ParametersObject in favor of Settings. (#599)

Co-authored-by: Copilot <copilot@github.com>

* Skip parameter binding if ParamemtersObject provided (#597)

* Skip parameter binding if the provider has already supplied a parameters object

* update

* update

---------

Co-authored-by: Zhiyuan Liang <zhiyuanliang@microsoft.com>

---------

Co-authored-by: Jimmy Campbell <jimmyca@microsoft.com>
Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: linglingye001 <143174321+linglingye001@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants