Skip to content

Upgrade guide change - NavigationException removal #61811

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

Open
ilonatommy opened this issue May 6, 2025 · 6 comments
Open

Upgrade guide change - NavigationException removal #61811

ilonatommy opened this issue May 6, 2025 · 6 comments
Labels
area-blazor Includes: Blazor, Razor Components Docs This issue tracks updating documentation
Milestone

Comments

@ilonatommy
Copy link
Member

ilonatommy commented May 6, 2025

PR: #61306.
Released in: 10.0.0-preview4.

Change description

Previously:

  • NavigationManager.Redirect in SSR was throwing an internal exception, interrupting the call stack execution.
  • Consequences: no code after the redirection would be reached and wrapping the redirection call into a try-catch could catch the internal exception, breaking the redirection mechanism.

Currently:

  • NavigationManager.Redirect in SSR rises a redirection event that the renderer is subscribed to. Code execution flow is uninterupted.
  • Consequences: code after redirection is executed.

Fallback to the previous way of working:

AppContext.SetSwitch("Microsoft.AspNetCore.Components.Endpoints.NavigationManager.EnableThrowNavigationException", isEnabled: true);

@guardrex

@ghost ghost added the area-blazor Includes: Blazor, Razor Components label May 6, 2025
@ilonatommy ilonatommy added the Docs This issue tracks updating documentation label May 6, 2025
@guardrex
Copy link
Contributor

guardrex commented May 6, 2025

It was resolved in the docs on dotnet/AspNetCore.Docs#34892.

However, the bit on the AppContext switch isn't covered. Do you want to cover it? I'd have to add a section to the Routing article because we never described the implementation details of how the redirect behavior worked internally.

@ilonatommy
Copy link
Member Author

Don't we have a separate document that would contain the change log in the context of upgrading the app? This is a breaking change. I had a feeling we have a special place in docs for these.

However, the bit on the AppContext switch isn't covered. Do you want to cover it? I'd have to add a section to the Routing article because we never described the implementation details of how the redirect behavior worked internally.

Yes, please, the fallback is important.

@ilonatommy
Copy link
Member Author

ilonatommy commented May 6, 2025

You know, like this https://learn.microsoft.com/en-us/aspnet/core/migration/80-90?view=aspnetcore-9.0 but for 9->10.

Edit:
I realized I called "update" instead of "upgrade", that's probably the source of confusion.

@ilonatommy ilonatommy changed the title Update guide change - NavigationException removal Upgrade guide change - NavigationException removal May 6, 2025
@guardrex
Copy link
Contributor

guardrex commented May 6, 2025

Yes, that's right for our migration coverage. However, the formal breaking changes log is maintained by the .NET docs team. For .NET 10 ...

https://learn.microsoft.com/en-us/dotnet/core/compatibility/10.0

So far, there's no "ASP.NET Core" section, but you can see one for 9.0 at ...

https://learn.microsoft.com/en-us/dotnet/core/compatibility/9.0#aspnet-core

For migration, yes, I'll make a note of it in a new documentation issue for our upcoming Migration article and reference this issue. UPDATE: Done! 👍 ... dotnet/AspNetCore.Docs#35360.

WRT reference content, I don't think we described the internal behavior of the redirect in the Blazor Routing article. I'll research it and report back, probably tomorrow (Wednesday). I added an issue to get the behavior and switch covered for Pre4 ... dotnet/AspNetCore.Docs#35361.

@guardrex
Copy link
Contributor

guardrex commented May 6, 2025

I confirmed that we don't describe the internal behaviors. We never mentioned the NavigationException in the first place outside of telling devs in the Movie dB tutorial how to silence the exception in VS, so I'll probably only need to add content to the WN article (and in Migration later when we reach the RC era) with Javier's summary from the PU issue of what the internal behavior was, is going to be, and how to fall back with the AppContext switch.

The issues are open and cross-linked into .NET 10 docs tracking and the Blazor.Docs project "10.0" column, so they won't get lost.

... and I've just noted that it will be for P5.

@danroth27
Copy link
Member

We'll need to provide specific guidance on how to update the IdentityRedirectManager from the Blazor Web App template when Individual Accounts auth is enabled. The IdentityRedirectManager previously through an InvalidOperationException after the call to RedirectTo to ensure the method wasn't being called from an interactive render mode and all the redirection methods were marked with [DoesNotReturn]. Users that currently have this code in their apps will need to remove the InvalidOperationException and the [DoesNotReturn] attributes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-blazor Includes: Blazor, Razor Components Docs This issue tracks updating documentation
Projects
None yet
Development

No branches or pull requests

4 participants