jspuij / TwokaB

Blazor WebView control for WPF, Android, macOS, iOS. Run Blazor on .NET Core and Mono natively inside a Webview.
https://jspuij.github.io/BlazorWebView.Docs/pages/index.html
Apache License 2.0
131 stars 15 forks source link

'RemoteNavigationManager' has not been initialized #31

Open ErikApption opened 4 years ago

ErikApption commented 4 years ago

We are trying to convert our electron app to BlazorWebView and our index page and other components requires the NavigationManager. The app fails with the default "An unhandled error has occured" and when running with "Just My Code" disabled - we can see the following exception

System.InvalidOperationException HResult=0x80131509 Message='RemoteNavigationManager' has not been initialized. Source=Microsoft.AspNetCore.Components StackTrace: at Microsoft.AspNetCore.Components.NavigationManager.AssertInitialized() in /_/src/Components/Components/src/NavigationManager.cs:line 223

Any suggestions?

jspuij commented 4 years ago

It seems that somehow you are trying to resolve from DI a navigationmanager for Server side blazor. The NavigationManager that is included with Blazor is called PlatformNavigationManager. (https://github.com/jspuij/TwokaB/blob/87ce929e9511c7fb26a516e8a001c8293804f1e5/src/BlazorWebView/PlatformNavigationManager.cs).

They should all be resolved as the abstract type NavigationManager though.