I've got a Server Side Blazor.NET application (dotnet core 3.1) with library: ProtectedBrowserStorage (https://www.nuget.org/packages/Microsoft.AspNetCore.ProtectedBrowserStorage) for encrypted storage in Client Browswer
Sometimes there are errors in my log files that looks like:
2020-04-01 14:05:17.4809 Error System.Threading.Tasks.TaskCanceledException: A task was canceled.
at Microsoft.JSInterop.JSRuntime.InvokeWithDefaultCancellation[T](String identifier, Object[] args)
at Microsoft.AspNetCore.ProtectedBrowserStorage.ProtectedBrowserStorage.GetAsync[T](String purpose, String key)
at PegasusV6.LocalStorageService.LoadBasket(MenuDTO menu) in LocalStorageService.cs:line 40 A task was canceled.
My problem is that I don't know what causes this error in JavaScript calls.
Is there maybe a Server restriction that can fix this kind of error?
Or is it client side that user maybe has not good internet speed / connection which is highly required for server side Blazor?
Hope someone can give me a hint or anything what could improve it. This is the C# function that is called:
public async Task LoadBasket(MenuDTO menu)
{
try
{
AppState.BasketData = await ProtectedLocalStore.GetAsync<BasketState>($"Basket_{My.StoreId}") ?? new BasketState();
}
catch (Exception ex)
{
My.Log.Error(ex);
AppState.BasketData = new BasketState();
}
}
Thanks!