-
Notifications
You must be signed in to change notification settings - Fork 10.4k
Blazor doesn't render ErrorBoundary's ErrorContent when there are two different exceptions inside it's ChildContent #39814
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Thanks for contacting us. |
Hey @xiety, thanks for reaching out. I just tried this out and was unable to reproduce this issue. Can you please provide a minimal, public, GitHub repository which reproduces this issue? |
Hi @xiety. We have added the "Needs: Author Feedback" label to this issue, which indicates that we have an open question for you before we can take further action. This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time. |
Hi @TanayParikh. You removed I reproduced it by adding |
I tried to make a minimal reproducible example. Of course there is much more code to |
So the |
And the following does not work:
|
I can confirm the bug. It is especially painful in the following setup: |
Here is my example:
|
Thanks for contacting us. We're moving this issue to the |
btw - This appears to be a duplicate of #38905. |
If you remove comment from second InputText control (multiple errors), index.razor @page "/"
<ErrorBoundary>
<ChildContent>
<Component2>
<InputText @bind-Value="@test.Prop1"></InputText>
</Component2>
<Component2>
@* <InputText @bind-Value="@test.Prop2"></InputText> *@
@* if you uncomment above line ErrorContent shows nothing *@
</Component2>
</ChildContent>
<ErrorContent Context="ex">
<p>@ex.Message</p>
<p>@ex.StackTrace</p>
</ErrorContent>
</ErrorBoundary>
@code {
Test test;
class Test
{
public string? Prop1 { get; set; }
public string? Prop2 { get; set; }
}
} Component2.razor <div>
@ChildContent
</div>
@code {
[Parameter] public RenderFragment? ChildContent { get; set; }
} |
Thanks for contacting us. We're moving this issue to the |
I'd like this to get some more attention than just pushing it back from one year to the next. This has been around since .NET 6, and now you have three releases with this same issue. I can confirm that this is an issue for me as well. The ErrorBoundary should be catching and rendering its ErrorContent if some async work in OnInitializedAsync throws shouldn't it? Instead it bubbles up to the whole application, whereas I want it to do what it claims to do. Keep it within the component's ErrorBoundary and handle it there. |
Thanks for contacting us. We're moving this issue to the |
Is there an existing issue for this?
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
ComponentWithError.razor
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.The text was updated successfully, but these errors were encountered: