question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Hybrid Windows crash when using IJSRuntime early on page load

See original GitHub issue

Version: 0.6.18-preview Platform: Windows WPF Exception:

System.InvalidOperationException: AttachToIpcChannel must be called before using IJSRuntime.
   at Microsoft.MobileBlazorBindings.WebView.BlazorHybridJSRuntime.ThrowIfIpcNotSet()
   at Microsoft.MobileBlazorBindings.WebView.BlazorHybridJSRuntime.BeginInvokeJS(Int64 asyncHandle, String identifier, String argsJson)
   at Microsoft.JSInterop.JSRuntime.InvokeAsync[TValue](String identifier, CancellationToken cancellationToken, Object[] args)
   at Microsoft.JSInterop.JSRuntime.InvokeAsync[TValue](String identifier, Object[] args)
   at Microsoft.JSInterop.JSRuntimeExtensions.InvokeAsync[TValue](IJSRuntime jsRuntime, String identifier, Object[] args)
   at Hara.WebCommon.JsInteropConfigProvider.GetRaw(String key) in C:\Git\Hara\Hara.WebCommon\JsInteropConfigProvider.cs:line 31

Cause: When loading a component inside hybrid blazor app inside MBB Windows, that uses IJSRuntime (in my case it is a call to localstorage.get), nested under OnAfterRenderAsync(firstRender) where firstRender is true.

Source: https://github.com/Kukks/Hara/tree/bump-and-fix-windows-support

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:1
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
arivera12commented, Dec 8, 2020

@Kukks I ran exactly into this error. I fix it using xamarin essentials secure storage instead of browser storage when working with native devices. I did a common interface which manage platform storage.

1reaction
arivera12commented, May 21, 2021

@Kukks I ran exactly into this error. I fix it using xamarin essentials secure storage instead of browser storage when working with native devices. I did a common interface which manage platform storage.

Thank you for the idea 😃 it works fine on Android by following this instructions . On the windows application, I got this exception:

System.AggregateException: 'One or more errors occurred. (This functionality is not implemented in the portable version of this assembly. You should reference the NuGet package from your main application project in order to reference the platform-specific implementation.)'.

This exception was originally thrown at this call stack:
    Xamarin.Essentials.SecureStorage.PlatformGetAsync(string)
    Xamarin.Essentials.SecureStorage.GetAsync(string)
    MyApplication.App.MyTask() in App.cs

How can I store on secure storage from the windows application? Thank you in advance

Xamarin essentials is not supported on win32/wpf but a port is being developed

Take a look of this PR

https://github.com/xamarin/Essentials/pull/1079

Read more comments on GitHub >

github_iconTop Results From Across the Web

My computer keeps crashing at the windows loading screen
when l start my computer, the windows loading logo appears. after a few seconds, the fans in my computer get really loud and...
Read more >
Handle errors in ASP.NET Core Blazor apps
This article describes how Blazor manages unhandled exceptions and how to develop apps that detect and handle errors.
Read more >
MAUI apps crash on launch on Windows after Visual ...
The program '[8104] MauiBugCrashOnLaunchOnWindows.exe' has exited with code 2147942405 (0x80070005). The usual steps such as deleting bin and ...
Read more >
Windows-based computer freeze troubleshooting
Learn how to troubleshoot computer freeze issues on Windows-based computers and servers. ... Try to use Windows remote administration tools.
Read more >
Hogwarts Legacy constantly crashing on PC
The game will still eventually crash depending on your graphics settings tho. First, lower all the graphics settings through GeForce experience.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found