Skip to content

Document breaking change: FileConfigurationSource.OnLoadException now observes IO errors - #55314

Open
gewarren with Copilot wants to merge 3 commits into
mainfrom
copilot/fix-file-configuration-source-onloadexception
Open

Document breaking change: FileConfigurationSource.OnLoadException now observes IO errors#55314
gewarren with Copilot wants to merge 3 commits into
mainfrom
copilot/fix-file-configuration-source-onloadexception

Conversation

Copilot AI commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

In .NET 11 Preview 7, a bug fix unified error handling in FileConfigurationProvider and its derivatives, so IO errors (e.g., from AddJsonFile, AddXmlFile, AddIniFile, or file reloads) are now forwarded to FileConfigurationSource.OnLoadException instead of only being observable via TaskScheduler.UnobservedTaskException. Code that unconditionally casts the exception in OnLoadException to InvalidDataException or FileNotFoundException can now throw InvalidCastException.

Changes

  • Added new breaking change article docs/core/compatibility/extensions/11/fileconfigurationsource-onloadexception-io-errors.md covering previous/new behavior, reason for change, and recommended action.
  • Registered the article in docs/core/compatibility/toc.yml under .NET 11 > Extensions.
  • Added a row for the article in the .NET 11 breaking changes index (docs/core/compatibility/11.md).

Example from the article

options.OnLoadException = context =>
{
    // Handle any exception type, not just InvalidDataException or FileNotFoundException.
    if (context.Exception is IOException ioException)
    {
        // Handle IO errors.
    }
    else if (context.Exception is InvalidDataException invalidDataException)
    {
        // Handle parsing errors.
    }

    context.Ignore = true;
};

Internal previews

File Preview link
docs/core/compatibility/11.md docs/core/compatibility/11
docs/core/compatibility/extensions/11/fileconfigurationsource-onloadexception-io-errors.md docs/core/compatibility/extensions/11/fileconfigurationsource-onloadexception-io-errors
docs/core/compatibility/toc.yml docs/core/compatibility/toc

Copilot AI review requested due to automatic review settings August 5, 2026 17:12

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot wasn't able to review any files in this pull request.

…O errors

Co-authored-by: gewarren <24882762+gewarren@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix FileConfigurationSource.OnLoadException callback for IO errors Document breaking change: FileConfigurationSource.OnLoadException now observes IO errors Aug 5, 2026
Copilot AI requested a review from gewarren August 5, 2026 17:15
Co-authored-by: Genevieve Warren <24882762+gewarren@users.noreply.github.com>
@gewarren
gewarren marked this pull request as ready for review August 5, 2026 21:06
@gewarren
gewarren requested a review from a team as a code owner August 5, 2026 21:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Breaking change]: FileConfigurationSource.OnLoadException callback is called for IO errors

3 participants