This repository was archived by the owner on Dec 26, 2025. It is now read-only.

Description
Describe the bug
IJSInProcessRuntime not available is thrown when trying to read from local storage.
Developing a cart where I use OnChange event to update the cart item counter. This have worked before with older .NET version.
To Reproduce
@inject Blazored.LocalStorage.ISyncLocalStorageService LocalStorage
@implements IDisposable
....
private int GetCartItemCount()
{
var cart = LocalStorage.GetItem<List<CartItemDto>>("b_cart"); // ERROR: IJSInProcessRuntime not available
return cart != null ? cart.Count : 0;
}
// subscribe to the cart changes event
protected override void OnInitialized()
{
CartService.OnChange += StateHasChanged;
}
public void Dispose()
{
CartService.OnChange -= StateHasChanged;
}
After adding items to the cart I invoke the OnChange event.
public event Action OnChange;
....
await _localStorage.SetItemAsync("b_cart", cart);
OnChange.Invoke();
Expected behavior
Counter should be updated with number of items in cart.
Hosting Model (is this issue happening with a certain hosting model?):
- Blazor WebAssembly .NET 9