You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe the problem.
There seems to be no way to invoke non-Blazor event handlers with Blazor error handling. Let's say I have an ErrorBoundary wrapping some component. This component uses System.Timers.Timer class to refresh the data once a certain period. It uses InvokeAsync method (as suggested here). The problem, however, is that all the errors happening within those event handlers are not handled neither by ErrorBoundary, nor by Blazor's Renderer in general. The exception is simply lost, not even logged anywhere.
You can take a look this this sample project https://github.com/Dreamescaper/BlazorRepro44871. It has two buttons. The first one throws an exception after awating a delay (it is handled by ErrorBoudary successfully). Second one throws Exceptions in Timer's events (exceptions are ignored).
Describe the solution you'd like
Ideally, ComponentBase.InvokeAsync method should handle exceptions, and push them through Blazor's error pipeline (probably catch the exception and pass it to Renderer.HandleExceptionViaErrorBoundary method).
If that's an unacceptable breaking change, a separate method or method overload should be added to handle this case.
The other option would be to make a public method on Renderer to handle the exception (similar to HandleExceptionViaErrorBoundary) so the user would be able to invoke it manually.
Additional context
This issue is quite similar to this closed item #27716, but with additional use case regarding ErrorBoundary.
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem? Please describe the problem.
There seems to be no way to invoke non-Blazor event handlers with Blazor error handling. Let's say I have an ErrorBoundary wrapping some component. This component uses System.Timers.Timer class to refresh the data once a certain period. It uses InvokeAsync method (as suggested here). The problem, however, is that all the errors happening within those event handlers are not handled neither by ErrorBoundary, nor by Blazor's Renderer in general. The exception is simply lost, not even logged anywhere.
You can take a look this this sample project https://github.com/Dreamescaper/BlazorRepro44871. It has two buttons. The first one throws an exception after awating a delay (it is handled by ErrorBoudary successfully). Second one throws Exceptions in Timer's events (exceptions are ignored).
Describe the solution you'd like
Ideally, ComponentBase.InvokeAsync method should handle exceptions, and push them through Blazor's error pipeline (probably catch the exception and pass it to Renderer.HandleExceptionViaErrorBoundary method).
If that's an unacceptable breaking change, a separate method or method overload should be added to handle this case.
The other option would be to make a public method on Renderer to handle the exception (similar to HandleExceptionViaErrorBoundary) so the user would be able to invoke it manually.
Additional context
This issue is quite similar to this closed item #27716, but with additional use case regarding ErrorBoundary.
The text was updated successfully, but these errors were encountered: