You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
Upgrading a Blazor project with LocalStorage from preview 2 to preview 3, specifically Microsoft.AspNetCore.Components.WebAssembly 3.2.0-preview2.20160.5 to 3.2.0-preview3.20168.3 breaks Local Storage. This seems to be a services issue.
crit: Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer[100] blazor.webassembly.js:1:36074
Unhandled exception rendering component: Cannot consume scoped service 'Blazored.LocalStorage.ILocalStorageService' from singleton {nameOfMySingleton}
To Reproduce
Create a Blazor preview 3 project using the template (WebAssembly ASP NET hosted)
Implement Blazored.LocalStorage (I tried v2.1.1 and 2.5.0)
See error
The text was updated successfully, but these errors were encountered:
The issue you're seeing is the result of a bug fix rather than a bug being created. You shouldn't have been able to use a scoped service in a singleton but that was being allowed to happen. As you can see for the error, that has now been fixed. Just to be clear, this is a fix in Blazor, there have been no changes in this library.
In order to fix this, you need to change the scope of your service which is consuming the ILocalStorageService to scoped.
I'm going to go ahead and close this issue as there isn't any work for us to do.
Describe the bug
Upgrading a Blazor project with LocalStorage from preview 2 to preview 3, specifically Microsoft.AspNetCore.Components.WebAssembly 3.2.0-preview2.20160.5 to 3.2.0-preview3.20168.3 breaks Local Storage. This seems to be a services issue.
To Reproduce
The text was updated successfully, but these errors were encountered: