-
Notifications
You must be signed in to change notification settings - Fork 10.2k
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
ErrorBoundary support for multiple exceptions #38905
Comments
Does it work as expected if you throw the exception in |
Hi @thirstyape. 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. |
Yes, it occurred in For reference, the component that is seeing issue is a Tab within a TabBar. A merge of the component tree has code similar to the following, I can provide more detailed samples if anything could use further investigation:
The |
Could you please provide a minimal (using the base Blazor template with minimal additions) public github repro project to allow us to investigate further? |
Hi @thirstyape. 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. |
Done, here is the repository. Changes to default template:
Steps to reproduce:
This will produce some exceptions and the Unexpected behavior: This is making me think the |
Thanks @thirstyape for the repro. I took a look and I believe it may be because in your example multiple exceptions are being thrown. If we update your example to just throw a single exception, things work as expected ( diff --git a/BlazorApp1/Shared/Tab.razor b/BlazorApp1/Shared/Tab.razor
index f59c9e1..475e711 100644
--- a/BlazorApp1/Shared/Tab.razor
+++ b/BlazorApp1/Shared/Tab.razor
@@ -16,8 +16,8 @@
[CascadingParameter]
private TabBar Parent { get; set; }
- protected override void OnInitialized()
- //protected override void OnParametersSet() // Changing to this will cause the issue
+ // protected override void OnInitialized()^M
+ protected override void OnParametersSet() // Changing to this will cause the issue^M
{
Parent.Tabs.Add(Name, Icon);
}
diff --git a/BlazorApp1/Shared/TabBar.razor.cs b/BlazorApp1/Shared/TabBar.razor.cs
index 24a6221..576ae92 100644
--- a/BlazorApp1/Shared/TabBar.razor.cs
+++ b/BlazorApp1/Shared/TabBar.razor.cs
@@ -39,8 +39,7 @@ public partial class TabBar
private void OnTabBarChanged(string tab)
{
- Active = tab;
- StateHasChanged();
+ throw new Exception("Yay for exceptions");^M
}
I believe this may be the case as well, I skimmed your code, but didn't immediately see what you were using to trigger the exception. My interpretation is the
@SteveSandersonMS are there any restrictions with respect to ErrorBoundary's and multiple exceptions? |
Hi @TanayParikh, thank you for reviewing this. Yes, as the |
I'll leave this open to confirm if there are any restrictions with respect to ErrorBoundary's and multiple exceptions. |
We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process. |
@TanayParikh I did some further testing today and I believe that we can close this out. I was able to use the sample project and get everything to work as expected as long as there was a single exception. I pushed my changes to the test. With these updates, the I think we can reasonably conclude that the multiple exceptions was the cause and is not currently a supported scenario. |
Thanks @thirstyape, let's keep this issue open to track potentially adding support for multiple exceptions in the future. |
Thank you for contacting us. Due to a lack of activity on this discussion issue we're closing it in an effort to keep our backlog clean. If you believe there is a concern related to the ASP.NET Core framework, which hasn't been addressed yet, please file a new issue. This issue will be locked after 30 more days of inactivity. If you still wish to discuss this subject after then, please create a new issue! |
@SteveSandersonMS would you like to keep this open? |
Sure, let's reopen and keep on backlog. |
We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process. |
Are there any updates on this topic? One year later it seems multiple exceptions at once are not supported by ErrorBoundary. The ErrorContent won't render. |
This bug is making the ErrorBoundary useless for real world scenarios. As soon as we have more than 1 component failing (in OnInitialized(Async), OnParameterSet(Async), nothing gets rendered on the screen (the render code is executed, but there is no output). |
Am I using this incorrectly? I implemented as per Documentation in
MainLayout.razor
with the slight change that in my<ErrorContent>
section I added a button that triggerserrorBoundary?.Recover();
.My test involved throwing a generic exception with a message from a child component in
protected override void OnInitialized()
. The result was that instead of displaying the content of@Body
or the ErrorContent, there was nothing. Upon opening the browser inspector I had an empty<main></main>
.I also tried creating a custom class that implemented ErrorBoundary, but this did not help either.
Originally posted by @thirstyape in #30874 (comment)
The text was updated successfully, but these errors were encountered: