Skip to content

Dotnet 9.0 scaffolding no longer works - errors when doing NavigationManager.NavigateTo in Create.razor #58951

@coderdnewbie

Description

@coderdnewbie

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

Perform the Dan Roth tutorial in https://www.youtube.com/watch?v=ZN-CcfEY3Z8

At 5:39 when the Create button is pressed, a failure happens in

NavigationManager.NavigateTo("/movies");

This is the failure in VS2022 17.12:

Microsoft.AspNetCore.Components.NavigationException
HResult=0x80131500
Message=Exception_WasThrown
Source=Microsoft.AspNetCore.Components.Server
StackTrace:
at Microsoft.AspNetCore.Components.Server.Circuits.RemoteNavigationManager.NavigateToCore(String uri, NavigationOptions options)
at Microsoft.AspNetCore.Components.NavigationManager.NavigateToCore(String uri, Boolean forceLoad)
at Microsoft.AspNetCore.Components.NavigationManager.NavigateTo(String uri, Boolean forceLoad, Boolean replace)
at BlazorMovieCRUDDemo.Components.Pages.MoviePages.Create.d__5.MoveNext() in C:\Users\ajayt\Desktop\Upgrade to dotnet 9 GA\BlazorMovieCRUDDemo\BlazorMovieCRUDDemo\Components\Pages\MoviePages\Create.razor:line 58
at Microsoft.AspNetCore.Components.ComponentBase.d__30.MoveNext()

This is from the autogenerated scaffolding performed exactly as Dan does it.

This used to work in dotnet 8.0, but now fails in dotnet 9.0.

Additionally, my dotnet 8.0 project when upgraded to dotnet 9.0 fails here as well.

Expected Behavior

I expect this to work as it did in dotnet 8.0

Steps To Reproduce

Perform the Dan Roth tutorial in https://www.youtube.com/watch?v=ZN-CcfEY3Z8

At 5:39 when the Create button is pressed, a failure happens in

NavigationManager.NavigateTo("/movies");

This is scaffolded code in Create.razor in the MoviePages subfolder.

Exceptions (if any)

This is the failure in VS2022 17.12:

Microsoft.AspNetCore.Components.NavigationException
HResult=0x80131500
Message=Exception_WasThrown
Source=Microsoft.AspNetCore.Components.Server
StackTrace:
at Microsoft.AspNetCore.Components.Server.Circuits.RemoteNavigationManager.NavigateToCore(String uri, NavigationOptions options)
at Microsoft.AspNetCore.Components.NavigationManager.NavigateToCore(String uri, Boolean forceLoad)
at Microsoft.AspNetCore.Components.NavigationManager.NavigateTo(String uri, Boolean forceLoad, Boolean replace)
at BlazorMovieCRUDDemo.Components.Pages.MoviePages.Create.d__5.MoveNext() in C:\Users\ajayt\Desktop\Upgrade to dotnet 9 GA\BlazorMovieCRUDDemo\BlazorMovieCRUDDemo\Components\Pages\MoviePages\Create.razor:line 58
at Microsoft.AspNetCore.Components.ComponentBase.d__30.MoveNext()

.NET Version

9.0.0

Anything else?

Image

Metadata

Metadata

Assignees

Labels

area-blazorIncludes: Blazor, Razor Components

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions