Skip to content

Conversation

@zhiyuanliang-ms
Copy link
Member

Why this PR?

#202

Visible Changes

Add Negate property to FeatureGateAttribute and add more constructors for it to allow the following usage:

[FeatureGate(requirementType: RequirementType.Any, negate: false, ["Home"])]

@rossgrambo
Copy link
Member

It looks like [FeatureGate("Home")] uses public FeatureGateAttribute(params string[] features)

Could you confirm that there's no weird interaction between
[FeatureGate(true)] and public FeatureGateAttribute(params object[] features)?

I think the generic object parameter might accidently catch the boolean.

@zhiyuanliang-ms
Copy link
Member Author

zhiyuanliang-ms commented Dec 11, 2024

@rossgrambo

image

[FeatureGate(true)] will throw exception: Unhandled exception. System.ArgumentNullException: Value cannot be null. (Parameter 'features')

I guess the constructor overload FeatureGateAttribute(params object[] features) has the lowest priority. So we are good here.

@zhiyuanliang-ms zhiyuanliang-ms merged commit 325271b into main Dec 11, 2024
4 checks passed
@zhiyuanliang-ms zhiyuanliang-ms deleted the zhiyuanliang/negate-feature-gate branch November 9, 2025 12:24
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