Quantcast
Channel: Active questions tagged blazor - Stack Overflow
Viewing all articles
Browse latest Browse all 4839

Unable to cast object of type 'Server.Circuits.RemoteNavigationManager' to type 'WebView.Services.WebViewNavigationManager'

$
0
0

Trying to move Blazor Web App to Hybrid result in exception on application start:

blazor.webview.js:1  Unable to cast object of type 'Microsoft.AspNetCore.Components.Server.Circuits.RemoteNavigationManager' to type 'Microsoft.AspNetCore.Components.WebView.Services.WebViewNavigationManager'.

I'm pretty sure that problem in usage of @inject NavigationManager Navigation at some of blazor components (pages). I registered razor components like this:

builder.Services    .AddRazorComponents()    .AddInteractiveServerComponents();

Without second part of line

builder.Services    .AddRazorComponents();    //.AddInteractiveServerComponents();

exception looks this way:

Unable to resolve service for type 'Microsoft.AspNetCore.Hosting.IWebHostEnvironment'while attempting to activate 'Microsoft.Extensions.DependencyInjection.DefaultRazorComponentsServiceOptionsConfiguration'

Without the whole line another exception throws:

ExampleBlazorApp does not implement IComponent.

Is there an alternative to this line to register correct NavigationManager class for Hybrid Blazor App to avoid this exceptions? Any ideas?


Viewing all articles
Browse latest Browse all 4839

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>