Blazor doesn't render ErrorBoundary's ErrorContent when there are two different exceptions inside it's ChildContent
See original GitHub issueIs there an existing issue for this?
- I have searched the existing issues
Describe the bug
ErrorBoundary renders nothing when there are two different errors inside it’s ChildContent.
Expected Behavior
ErrorBoundary renders exception information.
Steps To Reproduce
App.razor
<ErrorBoundary>
<ChildContent>
<ComponentWithError />
</ChildContent>
<ErrorContent>
<div style="background: red">@context</div>
</ErrorContent>
</ErrorBoundary>
ComponentWithError.razor
@{
throw new Exception("error2");
}
@code
{
protected override async Task OnInitializedAsync()
{
throw new Exception("error");
}
}
Exceptions (if any)
No response
.NET Version
6.0.101
Anything else?
I originally ran into this problem when I misspelled the parameter name in the inner component of ComponentWithError
:
<ComponentWithoutProp BadProp=1 />
Which throws an exception by itself.
Also with exception inside void OnInitialized()
everything works fine.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:5
- Comments:12 (7 by maintainers)
Top Results From Across the Web
Blazor WASM ErrorBoundary is not catching missing ...
This seems to work OK for exceptions thrown from withing life-cycle methods. For an App.razor file like: <ErrorBoundary> <ErrorContent> Got you!
Read more >Blazor "Error boundaries" design proposal · Issue #30940
The ErrorBoundary ancestor receives the HandleError call and responds by re-rendering itself. This time instead of rendering ChildContent , it ...
Read more >Handle errors in ASP.NET Core Blazor apps
Error boundaries provide a convenient approach for handling exceptions. The ErrorBoundary component: Renders its child content when an error ...
Read more >Unhandled Exceptions in Blazor Server with Error ...
Inside ErrorContent —which, for the record, is technically a RenderFragment<Exception> —displays when there's an unhandled error.
Read more >The .NET Stacks #57: Taking a look at Blazor Error Boundaries
Blazor Error Boundaries is not meant to be a global exception handling mechanism for any and all unhandled errors you encounter in your...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
And the following does not work:
https://blazorrepl.telerik.com/mcbucUvh06LNyOkj40
I tried to make a minimal reproducible example. Of course there is much more code to
await
in real use case.