Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Lists of tuples are not being serialized correctly #236

Open
PhilippJR opened this issue Jan 29, 2024 · 0 comments
Open

[Bug] Lists of tuples are not being serialized correctly #236

PhilippJR opened this issue Jan 29, 2024 · 0 comments
Labels
Bug Something isn't working Triage Issue needs to be triaged

Comments

@PhilippJR
Copy link

Lists of tuples are not being serialized correctly.

Steps to reproduce:

  1. Create new Blazor Wasm project.
  2. Make Blazored.LocalStorage available
  3. Replace everything in Home.razor with the following code
@page "/"
@using Blazored.LocalStorage
@inject ILocalStorageService _localstorage

<button @onclick="SetLocalStorage">Click me</button>
@code {
    private async Task SetLocalStorage()
    {
        var entries = new List<(string, int)> { ("foo", 1), ("bar", 2), ("baz", 3) };
        entries.ForEach(item => Console.WriteLine($"{item.Item1}: {item.Item2}"));
        await _localstorage.SetItemAsync("foobarbaz", entries);

        entries = await _localstorage.GetItemAsync<List<(string, int)>>("foobarbaz");
        entries.ForEach(item => Console.WriteLine($"{item.Item1}: {item.Item2}"));
    }
}
  1. Run app and click button.
  2. See in the console, that the second time, the values are written to the console, they are not correct.
  3. In the dev tools, see that "foobarbaz" contains a list of tuples but the tuples are empty.
@PhilippJR PhilippJR added Bug Something isn't working Triage Issue needs to be triaged labels Jan 29, 2024
@PhilippJR PhilippJR changed the title [Bug] [Bug] Lists of tuples are not being serialized correctly Jan 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working Triage Issue needs to be triaged
Projects
None yet
Development

No branches or pull requests

1 participant