microsoft / microsoft/FeatureManagement-Dotnet

IFeatureManager.IsAnabledAsync() doesn't get fresh information from IConfiguration in ASP.NET Framework

Open
#134 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
1.2k
Forks
129
Avg merge
1d 1h
Merged PRs (30d)
5

Description

Hello !

I have a problem in ASP.NET Framework WebForms application, there IFeatureManager.IsAnabledAsync() always returns cached data, but not fresh from IConfiguration, however in test console app for .NET Framework it works well.
Both projects use .NET Framework 4.8

I've found that, ConfigurationFeatureDefinitionProvider.cs#31 ChangeTokenConsumer delegate never called after refresher.TryRefreshAsync() or RefershAsync() is executed, but under debug I can see that IConfiguration is updated with new data.
P.S. For now I have quick solution - I just reset ConfigurationFeatureDefinitionProvider._stale flag manually by using reflection, and it works, but it's very bad idea, so I need a better solution.

Any ideas why this happening ?
Thanks for the help !

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with ConfigurationFeatureDefinitionProvider.cs at line 31 and compare how its ChangeTokenConsumer delegate is registered and triggered in the ASP.NET Framework WebForms app versus the working .NET Framework console app. Reproduce the issue around Refresher.TryRefreshAsync() or RefreshAsync(), verify that IConfiguration changes while the provider remains stale, and define done as fresh feature definitions being returned without reflection-based state changes.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.