-
Notifications
You must be signed in to change notification settings - Fork 10.4k
Closed
Labels
area-blazorIncludes: Blazor, Razor ComponentsIncludes: Blazor, Razor Componentsarea-middlewareIncludes: URL rewrite, redirect, response cache/compression, session, and other general middlewaresIncludes: URL rewrite, redirect, response cache/compression, session, and other general middlewares
Milestone
Description
We should take advantage of [DebuggerDisableUserUnhandledExceptions]
which was recently added to the runtime. dotnet/runtime#103105
In .NET 9, Visual Studio is adding support for catching async user-unhandled exceptions which will be enabled by default. This feature has existed for a long time for synchronous methods, but not for async methods. There are several exceptions in ASP.NET Core that propagate through user code but are expected to be handled by framework code. One example is the
NavigationException
used to force redirects when callingNavigationManager.NavigateTo()
during static Blazor rendering.
- NavigationExceptions that are properly handled by Blazor and turned into a redirect is an obvious candidate for this attribute since it is not expected for the user to handle these exceptions.
- We should also look at using this for exceptions handled by the
DeveloperExceptionPageMiddleware
andDatabaseDeveloperPageExceptionFilter
. The middleware could callDebugger.BreakForUserUnhandledException()
in DisplayException which would indicate that not custom filter like theDatabaseDeveloperPageExceptionFilter
handled the exception. There could be a custom filter registered that "handles" exceptions that still should be considered unhandled, but I think it's okay to slightly over suppress to begin with considering that the debugger would never break user-unhandled exceptions before .NET 9.
Metadata
Metadata
Assignees
Labels
area-blazorIncludes: Blazor, Razor ComponentsIncludes: Blazor, Razor Componentsarea-middlewareIncludes: URL rewrite, redirect, response cache/compression, session, and other general middlewaresIncludes: URL rewrite, redirect, response cache/compression, session, and other general middlewares