Skip to content

The StatusOverride doesn't work #393

@zhenlan

Description

@zhenlan

Hi, the StatusOverride doesn't work for me. May I get some help?

Here is my feature flag

{
	"id": "Greeting",
	"description": "",
	"enabled": true,
	"variants": [
		{
			"name": "Off",
			"configuration_value": "false",
			"StatusOverride": "Disabled"
		},
		{
			"name": "On",
			"configuration_value": "true",
			"StatusOverride": "Enabled"
		}
	],
	"allocation": {
		"percentile": [
			{
				"variant": "Off",
				"from": 0,
				"to": 80
			},
			{
				"variant": "On",
				"from": 80,
				"to": 100
			}
		],
		"default_when_enabled": "Off",
		"default_when_disabled": "Off"
	},
	"telemetry": {
		"enabled": true
	}
}

Here is my code for a razor page

public async void OnGet()
{
    Variant variant = await _featureManager.GetVariantAsync("Greeting", default);
    ShowGreeting = variant.Configuration.Get<bool>();

    // BUG: StatusOverride in the feature flag doesn't work. The following code will
    //      always return true even when the "Off" variant is assigned.
    bool showGreeting2 = await _featureManager.IsEnabledAsync("Greeting", default);
}

When "Off" variant is assigned, the IsEnabledAsync is expected to return false, but I always got true from it. This is their values under the debugger
image

Here are my project dependencies

  <ItemGroup>
    <PackageReference Include="Azure.Identity" Version="1.10.4" />
    <PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.22.0" />
    <PackageReference Include="Microsoft.Azure.AppConfiguration.AspNetCore" Version="8.0.0-preview" />
    <PackageReference Include="Microsoft.FeatureManagement.AspNetCore" Version="4.0.0-preview2" />
    <PackageReference Include="Microsoft.FeatureManagement.Telemetry.ApplicationInsights" Version="4.0.0-preview2" />
    <PackageReference Include="Microsoft.FeatureManagement.Telemetry.ApplicationInsights.AspNetCore" Version="4.0.0-preview2" />
  </ItemGroup>

Do I miss anything?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions