Closed yvztzn closed 3 years ago
UseExceptionHandler changes the request path and re-executes the middleware pipeline. Your exception throwing middleware will be hit again on the re-execution run and potentially throw a new exception.
If middleware exceptions are a common problem for you then you can use a different overload that creates an isolated pipeline for error handling. https://github.com/dotnet/aspnetcore/blob/c925f99cddac0df90ed0bc4a07ecda6b054a0b02/src/Middleware/Diagnostics/src/ExceptionHandler/ExceptionHandlerExtensions.cs#L59
UseExceptionHandler changes the request path and re-executes the middleware pipeline.
I knew that. But I was not clever enough to see that the /Error requests passes the same middleware which throws the exception. Thank you
Describe the bug
ExceptionHandlerMiddleware
responds with an error page if an exception occurs in a Razor page but does not if the exception occurs in some non-Razor middleware. Am I missing something?To Reproduce
Further technical details