Description
In .NET 11, dotnet/runtime#126093 changed how is reload token (obtainable using FileConfigurationProvider.GetReloadToken()) fired by FileConfigurationProvider when loading data using Load() method fails. If the loading fails with exception, and there is OnLoadException callback registered on related FileConfigurationSource which sets FileLoadExceptionContext.Ignore = true when processing error, then FileConfigurationProvider.OnReload is no longer called afterwards and reload token is not fired.
New behavior express semantic that it do not make sense to fire reload token when no load happen due to error. Previous behavior was consequence of exception handling control flow in FileConfigurationProvider which was reworked as part of bug fix.
Version
.NET 11 Preview 7
Previous behavior
FileConfigurationProvider.OnReload was called when initial configuration Load failed and there is callback which sets Ignored = true.
New behavior
FileConfigurationProvider.OnReload is not called when initial configuration Load failed and there is callback which sets Ignored = true.
Type of breaking change
Reason for change
Control flow rework as part of bug fix.
Recommended action
You need to update your application logic to not depend on token being fired when no data were loaded. Alternatively you can execute your handler yourself.
Feature area
Extensions
Affected APIs
- Microsoft.Extensions.Configuration.FileConfigurationProvider.Load()
- Microsoft.Extensions.Configuration.Ini.IniConfigurationProvider.Load()
- Microsoft.Extensions.Configuration.Json.JsonConfigurationProvider.Load()
- Microsoft.Extensions.Configuration.Xml.XmlConfigurationProvider.Load()
Description
In .NET 11, dotnet/runtime#126093 changed how is reload token (obtainable using
FileConfigurationProvider.GetReloadToken()) fired byFileConfigurationProviderwhen loading data usingLoad()method fails. If the loading fails with exception, and there isOnLoadExceptioncallback registered on relatedFileConfigurationSourcewhich setsFileLoadExceptionContext.Ignore = truewhen processing error, thenFileConfigurationProvider.OnReloadis no longer called afterwards and reload token is not fired.New behavior express semantic that it do not make sense to fire reload token when no load happen due to error. Previous behavior was consequence of exception handling control flow in
FileConfigurationProviderwhich was reworked as part of bug fix.Version
.NET 11 Preview 7
Previous behavior
FileConfigurationProvider.OnReloadwas called when initial configuration Load failed and there is callback which setsIgnored = true.New behavior
FileConfigurationProvider.OnReloadis not called when initial configuration Load failed and there is callback which setsIgnored = true.Type of breaking change
Reason for change
Control flow rework as part of bug fix.
Recommended action
You need to update your application logic to not depend on token being fired when no data were loaded. Alternatively you can execute your handler yourself.
Feature area
Extensions
Affected APIs