Closed mrpmorris closed 2 months ago
Thanks for reaching out. This is by design - NavigationException
is intended to be caught by the framework to be handled as a redirect. Our guidance is to not catch that exception. We currently have #55685 tracking an alternative approach to initiating redirects.
Is there an existing issue for this?
Describe the bug
In a Blazor SSR app, NavigationManager.NavigateTo always throws an exception.
The problem with this approach is when debugging
async await
methods in Visual Studio the debugger does not stop to show this exception, so the developer is unaware.It is therefore likely the developer will include the call to NavigateTo within a try block, and then navigation fails...
Expected Behavior
It should not throw an exception.
I should be able to write the same code as I would for Server or WASM Blazor apps.
Steps To Reproduce
Exceptions (if any)
Microsoft.AspNetCore.Components.NavigationException
.NET Version
8.0.303
Anything else?
No response