Skip to content

[Breaking change]: FileConfigurationProvider.OnReload is not called when Load() fails #55023

Description

@mrek-msft

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

  • Binary incompatible: Existing binaries might encounter a breaking change in behavior, such as failure to load or execute, and if so, require recompilation.
  • Source incompatible: When recompiled using the new SDK or component or to target the new runtime, existing source code might require source changes to compile successfully.
  • Behavioral change: Existing binaries might behave differently at run time.

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()

Metadata

Metadata

Assignees

Labels

🗺️ reQUESTTriggers an issue to be imported into Quest.breaking-changeIndicates a .NET Core breaking change

Type

No type

Projects

Status
🔖 Ready

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions