Conflict with System.text.json
See original GitHub issueNot an issue with the SessionStorage code, but prevents its use in Blazor server apps.
Affects SessionStorage and LocalStorage. I get the same log info from msbuild as reported here: https://github.com/dotnet/aspnetcore/issues/23126
App runs as expected despite warning locally but crashes in hosted setting yielding:
An unhandled exception has occurred while executing the request. System.IO.FileNotFoundException: Could not load file or assembly ‘System.Text.Json, Version=4.0.1.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51’. The system cannot find the file specified. File name: ‘System.Text.Json, Version=4.0.1.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51’ at Blazored.SessionStorage.SessionStorageService…ctor(IJSRuntime jSRuntime, IOptions`1 options)
To Reproduce Include library in trivial blazor server app. Compile.
Warning MSB3277 Found conflicts between different versions of “System.Text.Json” that could not be resolved.
Hosting Model (is this issue happening with a certain hosting model?):
- Blazor Server
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:8 (2 by maintainers)
Top GitHub Comments
I myself fixed it by installing the System.Text.Json from NuGet. I am really new to the whole .NET environment, so take this solution with some kilograms of salt 😅
Sorry, it’s taken a while to look at this. I’ve added a comment to the issue @bstorage linked in the opening comment, suggesting your fix @larsk2009. I’ll wait to hear back from that before doing anything as I’m not sure what the impact of changing the target framework would be.