Cache expiration field has been renamed to CacheExpirationInterval. Code won't work for someone using 2.2.0 of Microsoft.FeatureManagement.AspNetCore
Additionally, it looks like a feature flag needs a label for the hot reload to work and that label needs to match the config, according to this post https://github.com/microsoft/FeatureManagement-Dotnet/issues/30#issuecomment-565096742
⚠Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
Hello @softchris , thanks for the feedback! We are currently investigating and will update you shortly.
@softchris, you are thinking in the right direction. It looks like the documentation is not yet updated with the new client library changes.
I had a sync up internally with the PG and got to know that this change in the documentation is in progress and will soon be updated. So, stay tuned!
Let me know if this addresses your query.
sounds good, thanks.. maybe a separate issue but can you confirm if there are issues with the hot reloading? Cause I can't get it to work on 2.2.0, even though flag label and label in config is the same..
Hi @softchris, to address your original concern, yes the Cache expiration field has been renamed and this needs to be updated. Thank you for pointing this out.
Could you elaborate on what issues you are having for hot reloading? We do not have any issues with refresh right now on our side. Labels are not a part of this tutorial. Are you calling UseFeatureFlags() and querying for your label in your application when you connect to App Configuration?
@softchris, just checking in to see if you can respond to @AlexandraKemperMS 's question. She is from the Product's group.
@HarshitaSingh-MSFT @AlexandraKemperMS This is the code I'm trying to set up for reload of feature flags.. Am I doing it wrong? I wait 5-10 seconds and then reload the page.. Value does not seem to propagate (when app is run locally):
public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder =>
webBuilder.ConfigureAppConfiguration((hostingContext, config) =>
{
var settings = config.Build();
var connection = settings.GetConnectionString("AppConfig");
var env = hostingContext.HostingEnvironment.EnvironmentName;
config.AddAzureAppConfiguration(options =>
options
.Connect(connection)
.UseFeatureFlags(opt =>
{
opt.Label = env;
opt.CacheExpirationInterval = TimeSpan.FromSeconds(5);
}));
}).UseStartup<Startup>());
}
@softchris This looks good. I tried your code and it worked for me - but I had to use ChacheExpirationTime instead of CacheExpirationInterval. Even when I specified the most recent version of microsoft.extensions.configuration.azureappconfiguration and 2.2.0 of Microsoft.FeatureManagement.AspNetCore.
Could you double check that you are calling UseAzureAppConfiguration like in Step 5 in the tutorial here? What does your configure method look like? Also, have you tried reloading it twice after changing the state of the feature flag?
I can't use CacheExpirationTime, it says the property don't exist ( FeatureFlag options does not contain a definition for CacheExpirationTime ). Here's my project file:
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<UserSecretsId></UserSecretsId>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Azure.AppConfiguration.AspNetCore" Version="4.0.0" />
<PackageReference Include="Microsoft.FeatureManagement.AspNetCore" Version="2.2.0" />
</ItemGroup>
</Project>
.NET Core version 5.0.100
@AlexandraKemperMS
This has been resolved offline. app.UseAzureAppConfiguration(); was missing from the Configure() method in Startup.cs.
Please feel free to reach out with any other questions you have for App Configuration by raising another issue.