-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Open
Labels
area-blazorIncludes: Blazor, Razor ComponentsIncludes: Blazor, Razor Components
Milestone
Description
Is there an existing issue for this?
- I have searched the existing issues
Describe the bug
This is similar to #56413 but that issue appear to be for Server Interactive or cross-boundary components. However, this issue also happen when the component is fully client-side (InteractiveWebAssembly, including with pre-rendering set to false).
Expected Behavior
ErrorBoundary should prevent exceptions to go up and show ErrorContent
instead.
Steps To Reproduce
- Create a new project using Blazor Web App template, choose WebAssembly interactive and Per Page/Component mode.
- In
BlazorApp1.Client
, create a compoent likeInteractiveApp.razor
:
@rendermode InteractiveWebAssembly
<ErrorBoundary>
<ChildContent>
<button @onclick="ThrowErr">Throw</button>
</ChildContent>
<ErrorContent Context="ex">
Error: @(ex.Message)
</ErrorContent>
</ErrorBoundary>
@code {
void ThrowErr() => throw new InvalidOperationException("An error occurred.");
}
- Add this component to the BlazorApp1's
Home.razor
:
@page "/"
<InteractiveApp />
- Run the app and click the Throw button.
Exceptions (if any)
The thrown exception go up and cause the bottom bar to show up instead of being handled by the ErrorBoundary.
.NET Version
No response
Anything else?
No response
Metadata
Metadata
Assignees
Labels
area-blazorIncludes: Blazor, Razor ComponentsIncludes: Blazor, Razor Components