Closed as not planned
Description
Is there an existing issue for this?
- I have searched the existing issues
Describe the bug
I'm trying to use the UseExceptionHandler
middleware to handle exceptions thrown when Blazor server-side rendering pages and am receiving an unexpected error when the middleware executes.
Expected Behavior
The request re-executes and I'm sent to my error page.
Steps To Reproduce
- Create a new blazor web project -
dotnet new blazor
- Create an
/Error
page (the template is missing this page despite having the exception handler go there). - Run the project with anything other than the
Development
environment.
These steps in a repo -> https://github.com/benjaminsampica/BlazorServerSideRendering
Exceptions (if any)
System.InvalidOperationException: 'HttpNavigationManager' already initialized.
at Microsoft.AspNetCore.Components.NavigationManager.Initialize(String baseUri, String uri)
at Microsoft.AspNetCore.Components.Endpoints.EndpointHtmlRenderer.InitializeStandardComponentServicesAsync(HttpContext httpContext, Type componentType, String handler, IFormCollection form)
at Microsoft.AspNetCore.Components.Endpoints.RazorComponentEndpointInvoker.RenderComponentCore()
at Microsoft.AspNetCore.Components.Rendering.RendererSynchronizationContext.<>c.<<InvokeAsync>b__9_0>d.MoveNext()
--- End of stack trace from previous location ---
at Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddlewareImpl.HandleException(HttpContext context, ExceptionDispatchInfo edi)
Microsoft.AspNetCore.Server.Kestrel: Error: Connection id "0HMS6ET6U8UL7", Request id "0HMS6ET6U8UL7:00000001": An unhandled exception was thrown by the application.
.NET Version
.NET 8 preview 6
Anything else?
No response