-
Notifications
You must be signed in to change notification settings - Fork 10.3k
Reconcile NavigationManager behavior to no longer use NavigationException #59451
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Related issue #53996 |
Hi |
@indcoder thanks for contacting us. This behavior hasn't changed between .NET 8.0 and .NET 9.0. During prerendering we've always thrown a |
@indcoder could you please describe your previous and current experience in more detail ? |
This behavior hasn't changed between 6,7,8 or 9. During prerendering, The purpose of this issue is to get rid of the |
Hi @pavelsavara @javiercn I encountered this issue circa Dec'24 when implementing IAM for the app. Searched on GH...and it was identical to Adam's experience adamfoneil/CardGameSDK#16 who also has referenced this issue. I didn't revert back to 8 nor take screenshots/video since ours was a relatively greenfield project but rather opted for global interactivity with prerendering disabled. And I only revisited this issue since Aspire 9.1 was about to be released. This issue was always one of the caveats we had to give when folks try out Blazor and start implementing IAM https://x.com/hackmum/status/1878801401759043931, and I thought it was high enough in the priority to tackle it early. I am now reconciled to the fact that this will be solved only by the .NET 10 timeframe and I'm glad to see IAM story in Blazor getting a larger mindshare in .NET 10 @danroth27 ![]() Because the arduous workaround to adopt a minimally adequate security posture for Blazor Web App has been its Achilles heel for its adoption. Even the movie sample app that @guardrex references this issue does not implement IAM Also, hopefully for .NET 10, while we are at it, the IAM chain is being holistically examined to make it frictionless for folks to secure their Blazor app across any combination of render modes, in the process jettisoning the remnants of .NET framework in the IAM chain e.g.: 👇 ![]() |
@indcoder thanks for the additional details. It's unclear to us how what you are describing is related to this issue. If there's anything that you want to propose or that you have problems with, could you please file a separate issue describing the concrete problem that you are having and what you are proposing to that regard? Thanks. |
Also, there is one more inconsistency between the interactive modes and SSR, if I pass in a value of |
The behavior NavigationManager exhibits is different in SSR rendering than it is on other interactive modes. In particular, SSR relies on throwing an exception that gets captured by the framework to convert the error into a redirect.
This behavior leads to a poor user experience where users debugging their apps typically see the debugger break when this exception is thrown and incorrectly believe that there is an error/bug on the framework.
In addition to this, code that exists after a call to
NavigateTo
will continue to execute on interactive render modes but will abruptly stop in SSR scenarios.The solution for this involves a breaking change, but the number of issues that the current behavior produces justifies such change. We should stop throwing an exception during SSR and instead signal the underlying renderer that a redirection has been requested. We should continue to execute the current ongoing synchronous render batch until completion and, once it finishes, we should dispose the existing renderer and trigger the redirect. This will align the behavior with what happens in other platforms, but we should also have a suite of tests that capture these behaviors across render modes to ensure a consistent experience.
For backcompat reasons we will include an AppContext switch that will continue to throw the exception in case someone needs it.
The text was updated successfully, but these errors were encountered: