MudBlazor / MudBlazor

Blazor Component Library based on Material design with an emphasis on ease of use. Mainly written in C# with Javascript kept to a bare minimum it empowers .NET developers to easily debug it if needed.
http://mudblazor.com
MIT License
7.22k stars 1.18k forks source link

MudNavLink unhandled exception on event callback not caught by Microsoft.AspNetCore.Components.Web.ErrorBoundary #8796

Closed empdk closed 3 weeks ago

empdk commented 3 weeks ago

Bug type

Component

Component name

MudNavLink

What happened?

When simulating an unhandled exception on MudNavLink's on click event, the unhandled exception is not caught by Microsoft.AspNetCore.Components.Web.ErrorBoundary and the ErrorContent of ErrorBoundary is not displayed. The issue can be seen in the latest version 6.19.1. Last working version is 6.17.0.

<ErrorBoundary><ChildContent><divclass="page"><divclass="sidebar"><MudButtonOnClick='(()=>thrownewSystem.InvalidOperationException("ThrowButton"))'>ThrowButton</MudButton><MudNavLinkIcon="fafa-solidfa-house"OnClick='(()=>thrownewSystem.InvalidOperationException("ThrowNavLink"))'>ThrowNavLink</MudNavLink></div><main><divclass="top-rowpx-4"><ahref="https://learn.microsoft.com/aspnet/core/"target="_blank">About</a></div><articleclass="contentpx-4">@Body</article></main></div></ChildContent><ErrorContent><divstyle="background:red;color:white;">AnErrorHasOccured</div></ErrorContent></ErrorBoundary>

image

Expected behavior

When clicking MudNavLink that will throw an unhandled exception, the unhandled exception should be caught by Microsoft.AspNetCore.Components.Web.ErrorBoundary and displayed the error content of the boundary.

Reproduction link

""

Reproduction steps

  1. Wrap main layout in Microsoft.AspNetCore.Components.Web.ErrorBoundary
  2. Add custom ErrorContent for ErrorBoundary
  3. Add a MudNavLink to the ChildContent of ErrorBoundary
  4. Throw an unhandled exception on the MudNavLink click event

Relevant log output

No response

Version (bug)

6.18.0+

Version (working)

6.17.0

What browsers are you seeing the problem on?

Edge

On which operating systems are you experiencing the issue?

Windows

Pull Request

Code of Conduct

ScarletKuro commented 3 weeks ago

Duplicate of https://github.com/MudBlazor/MudBlazor/issues/8437