Comments (14)
@chrissainty .NET 8 Blazor wasm only project (bumped from and was working with 6) with the same issue as described. The version of LocalStorage is the same (4.4.0). Browser is Edge latest on Windows 10.
The call it gets down to is:
BrowserStorageProvider::GetItemAsync
return await _jsRuntime.InvokeAsync<string>("localStorage.getItem", cancellationToken, key);
Nothing raised, nothing logged in VS or the browser console just hangs there seemingly forever.
from localstorage.
Browser details - no local storage error thrown just a disconnect from blazor server
from localstorage.
Hey @sponsorrockit, can you provide a minimal repro project, the package is working fine as far as a I can see testing on the sample projects and in a fresh project.
from localstorage.
from localstorage.
from localstorage.
Thanks for the detailed explanation @sponsorrockit.
Just to clarify, are you putting an object into local storage that contains 30+ other objects (your whole domain pretty much)? Just that you said you weren't happy sharing them here but anyone who uses your app will be able to get hold of them.
In terms of the issue you're seeing, it sounds like it might be a System.Text.Json
problem. If you're saving one structure and then changing that structure and attempting to read it out again, it might need some extra configuration to handle that. It's not as forgiving as Newtonsoft JSON is. Have you tried adjusting the serialiser?
from localstorage.
I am having a similar issue trying
var StoredFormModels = await LocalStorage.GetItemAsync<List>("Forms");
I have not been able to narrow it down yet, however what is truly the bigger issue is that even though this is wrapped in a try/catch, it never reaches the catch.
It simply fails silently and causes the web socket to refresh. No errors in console or server.
from localstorage.
@chrissainty I'm not sure if you had a chance to review my comment above. Any ideas on how we can get this to fail properly?
`async void SaveFormLocally()
{
try
{
if (PageVm.FormPageVm == null) return;
PageVm.FormPageVm.CustomFormSubmission.DateSubmitted = DateTime.UtcNow;
PageVm.FormPageVm.CustomFormSubmission.CustomFormId = PageVm.FormPageVm.CustomForm.CustomFormId;
var StoredFormModels = await LocalStorage.GetItemAsync<List<CustomFormSubmission>>("ProofpixForms");
if (StoredFormModels != null)
{
if (StoredFormModels.Any(x => x.CustomForm.CustomFormId == PageVm.FormPageVm.CustomFormSubmission.CustomForm.CustomFormId))
{
var StoredCustomFormSubmission = StoredFormModels.FirstOrDefault(x => x.CustomForm.CustomFormId == PageVm.FormPageVm.CustomFormSubmission.CustomForm.CustomFormId);
if (StoredCustomFormSubmission != null)
{
StoredFormModels.Remove(StoredCustomFormSubmission);
}
StoredFormModels.Add(PageVm.FormPageVm.CustomFormSubmission);
}
else
{
StoredFormModels.Add(PageVm.FormPageVm.CustomFormSubmission);
}
}
else
{
StoredFormModels = new List<CustomFormSubmission> { PageVm.FormPageVm.CustomFormSubmission };
}
await LocalStorage.SetItemAsync("ProofpixForms", StoredFormModels);
}
catch (Exception Ex)
{
Console.WriteLine(Ex.ToString());
}
}`
from localstorage.
Also, swapped out this library for another and it exhibited the exact same issue. If it wasn't already obvious it's safe to say that it's a .NET 8 wasm issue rather than an issue with this library.
from localstorage.
I'm using Blazer Server .net 7 with System.Text.Json.
I ended up saving my data as strings and then serialize those to avoid the issue. Seems to be working so far.
from localstorage.
Actually, I take that back. I am getting a socket reset with no error now calling:
var StoredFormStrings = await LocalStorage.GetItemAsync<List>("ProofpixForms");
from localstorage.
After coming across this issue and having the same problem myself in Blazor Server .NET 6.0
& lib version 4.3.0
I get no exception and the connection just resets.
It must have something to do with the object size. Although the object ends up in the storage the connection just crushes. When I reduced the size of my object it worked fine. It didn't matter if I used the AsString
or serialized it to a string myself.
from localstorage.
For Blazor Server, some people could be hitting the default limit of the SignalR connection. It's worth trying to up that and see if that cures the issues.
from localstorage.
@chrissainty yes for server increasing the limit fixed the problem thanks.
from localstorage.
Related Issues (20)
- How to send facebook token(passport-facebook) from Frontend after I logged in?
- how inject in Code behind in program.cs HOT 5
- AddBlazoredLocalStorage() add public setter for options.JsonSerializerOptions HOT 2
- [Bug] Impossible to make it work HOT 1
- [Bug] ASP.NET Core AggregateException on startup after injecting BlazorLocalStorage with dependency injection HOT 2
- [Bug] Performance Impact on Multiple SetItem Calls
- [Security] Consider updating Microsoft.AspNetCore.Components.Web dependency
- Net 8.0 iOS System.Text.Json.Serialization.JsonConverter System.ArgumentOutOfRangeException [Bug] HOT 1
- Unhandled exception rendering component: Please use dedicated worker for working with JavaScript interop. See https://aka.ms/dotnet-JS-interop-threads
- .Net 8 RenderMode.InteractiveServer CustomAuthenticationStateProvider[Bug] HOT 2
- Error in .NET 8 : Method not found HOT 3
- [Feature Request] Common Interface between ILocalStorageService and ISessionStorageService
- is it not working on net maui Hybrid? HOT 1
- [Bug] Lists of tuples are not being serialized correctly
- blazored.localstorage is missing NuGet package README file
- [Bug] Can't use local storage in a SSR HOT 1
- [Question] How can I use it in program.cs ? HOT 3
- Whether cookie operations can be added
- [Feature Request] An option to automatically add `location.pathname` to keys
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from localstorage.