You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
AddFeatureManagement doesn't Register a Custom Configuration #546
In 4.2.0, we added an enhancement #536 that we will merge Microsoft feature flags from different configuration sources.
This enhancement will make the operation to GetMicrosoftFeatureDefinitionSections becomes more time-consuming.
Before 4.2.0, we will get all configuration sections for feature definitions and find the feature flags among them each time when there is no cache. code
In 4.2.0, to improve the performance, we will cache all configuration sections for feature definitions when constructing the ConfigurationFeatureDefinitionProvider. code. So, until the configuration is changed, we only get all configuration sections for feature definitions for once and it happens in the constructor of the ConfigurationFeatureDefinitionProvide.
the above the usage is something we called RootConfigurationFallback. It will only be set to true when you provide an IConfiguration when calling AddFeatureManagement. The RootConfigurationFallbackEnabled property of ConfigurationFeatureDefinitionProvider is set to true after the constructor of the ConfigurationFeatureDefinitionProvider. code So, for the first time we call GetDotnetFeatureDefinitionSections in the constructor, the RootConfigurationFallbackEnabled will not be respected. This caused the issue.
Activity
micheltol commentedon Jun 30, 2025
I can confirm this issue. It worked with version 4.1.0
zhiyuanliang-ms commentedon Jun 30, 2025
Hi, Michel Tol (@micheltol) daniell-reeco
I am sorry about this issue. This is an oversight. It is a bug introduced in 4.2.0.
In 4.2.0, we added an enhancement #536 that we will merge Microsoft feature flags from different configuration sources.
This enhancement will make the operation to GetMicrosoftFeatureDefinitionSections becomes more time-consuming.
Before 4.2.0, we will get all configuration sections for feature definitions and find the feature flags among them each time when there is no cache. code
In 4.2.0, to improve the performance, we will cache all configuration sections for feature definitions when constructing the
ConfigurationFeatureDefinitionProvider. code. So, until the configuration is changed, we only get all configuration sections for feature definitions for once and it happens in the constructor of theConfigurationFeatureDefinitionProvide.However,
the above the usage is something we called
RootConfigurationFallback. It will only be set totruewhen you provide anIConfigurationwhen callingAddFeatureManagement. TheRootConfigurationFallbackEnabledproperty ofConfigurationFeatureDefinitionProvideris set totrueafter the constructor of theConfigurationFeatureDefinitionProvider. code So, for the first time we call GetDotnetFeatureDefinitionSections in the constructor, theRootConfigurationFallbackEnabledwill not be respected. This caused the issue.I have sent out a bug fix PR: #547
Put more backgrounds here:
We have some back and forth on this feature. we even removed this feature in 3.0.0 and added it back in 3.1.0. #308 #312
You might have question: why we don't use
initkey word. Here is the reason.jimmyca15 commentedon Jun 30, 2025
Thanks for reporting this issue. Package version 4.2.0 has been unlisted
zhiyuanliang-ms commentedon Jul 10, 2025
daniell-reeco Michel Tol (@micheltol) 4.2.1 is released. It should fix the issue.