Closed mischa71lab closed 5 years ago
on another blazor storage package i read this:
Due to pre-rendering in Blazor Server you can't perform any JS interop until the OnAfterRender lifecycle method.
Doing this seems to have solved the issue:
protected override async Task OnAfterRenderAsync()
{
await Storage.SetItemAsync("Token", "bla");
var token = await Storage.GetItemAsync("Token");
};
Yes i think, while pre-rendering there is no way to access the browser storage.
I'll try to add a better error message
thanks. maybe add this to example how to use server side
protected override async Task OnAfterRenderAsync()
Hi,
I'm getting a null reference exception when i use this code:
any ideas?
NullReferenceException: Object reference not set to an instance of an object. Microsoft.AspNetCore.Components.Server.Circuits.RemoteJSRuntime.BeginInvokeJS(long asyncHandle, string identifier, string argsJson) Microsoft.JSInterop.JSRuntime.InvokeAsync(string identifier, CancellationToken cancellationToken, object[] args)
Cloudcrate.AspNetCore.Blazor.Browser.Storage.StorageBase+JsRuntimeAccessBase.InvokeAsync(string identifier, IEnumerable