InvalidCastException: Unable to cast object of type 'Microsoft.AspNetCore.Components.WebView.Services.WebViewNavigationManager' to type 'Microsoft.AspNetCore.Components.Routing.IHostEnvironmentNavigationManager'. #47613
Labels
area-blazor
Includes: Blazor, Razor Components
✔️ Resolution: Answered
Resolved because the question asked by the original author has been answered.
question
Status: Resolved
Is there an existing issue for this?
Describe the bug
Hi,
I am trying to host Razor views (*.cshtml) in an hybrid wpf app (BlazorWebView). Got everyting working with memory based OWIN loopback. But ran into this cast when Microsoft.AspNetCore.Mvc.ViewFeatures.StaticComponentRenderer tries to render it.
It appears webview NavigationManager does not implement IHostEnvironmentNavigationManager, which the MVC stack expects.
Should'nt webview NavigationManager be implemented similiar to
https://github.com/dotnet/aspnetcore/blob/main/src/Components/Server/src/Circuits/RemoteNavigationManager.cs
Expected Behavior
Implement IHostEnvironmentNavigationManager on Webview NavigationManager.
Steps To Reproduce
Start with Wpf Hybrid app and add MVC stack with owin middleware.
Exceptions (if any)
InvalidCastException
.NET Version
.Net 7
Anything else?
No response
The text was updated successfully, but these errors were encountered: