Open PhilippJR opened 10 months ago
Lists of tuples are not being serialized correctly.
Steps to reproduce:
@page "/" @using Blazored.LocalStorage @inject ILocalStorageService _localstorage
<button @onclick="SetLocalStorage">Click me @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}")); }
}
4. Run app and click button. 5. See in the console, that the second time, the values are written to the console, they are not correct. 6. In the dev tools, see that "foobarbaz" contains a list of tuples but the tuples are empty.
Lists of tuples are not being serialized correctly.
Steps to reproduce:
<button @onclick="SetLocalStorage">Click me @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);
}