Closed
Description
Summary
This proposes adding an error boundaries feature to Blazor, as inspired by the implementation in React. This feature would allow developers to implement logic on individual components to capture any excpetions, log, display a fallback UI, send telemetry, etc.
This feature was proposed in #13452 but I'm pulling it out into a separate issue to be more precise about the proposed solution.
Motivation
A meaningfully complex Blazor app will contain numerous components, both first-party and third-party. There's no way to guarantee that all exception cases will be handled in a component. There's also no way to indicate that even though an unhandled exception occurred in one part of the app, that the entire app is not compromised.
Goals
- Allow users to provide fallback UIs for select component subtrees in the event that there is an exception there
- Allow users to build apps with cleaner fallback experiences in the event of unexpected UIs
- Give users more fine-grained control over how failures are handled in the app
Non-goals
- Implement any kind of global exception handling in Blazor (we already have
ILogger
for logging, and beyond that, truly unhandled exceptions mean the app is in an undefined state which is unsafe to continue) - Add more sophisticated exception handling to the components in Blazor (besides the APIs needed to build this feature)
Metadata
Metadata
Assignees
Labels
This issue has been fixedWork that is important, but not critical for the releaseA single user-facing feature. Can be grouped under an epic.This issue impacts approximately half of our customersIncludes: Blazor, Razor ComponentsThis issue represents an ask for new feature or an enhancement to an existing oneThis label is used by an internal tool