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

ProtectedBrowserStorage can't load more than 25kb #47945

Closed
1 task done
tossnet opened this issue Apr 28, 2023 · 3 comments
Closed
1 task done

ProtectedBrowserStorage can't load more than 25kb #47945

tossnet opened this issue Apr 28, 2023 · 3 comments
Labels
area-dataprotection Includes: DataProtection

Comments

@tossnet
Copy link

tossnet commented Apr 28, 2023

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

on a simple Blazor Server .NET 7 project for example, if I store a 25kb value, I can't read it back

Expected Behavior

No response

Steps To Reproduce

Create a new projet Blazor Server .NET 7 and paste this on Index.razor :

@page "/"
@inject ProtectedSessionStorage sessionStorage

<button @onclick="ReadSave">Test</button>

@avatar

@code {
    string avatar;

    private async Task ReadSave()
    {
        // Create a long string
        int max = 24445; // ok with 24445
                         // change to 24446 it stop when reading

        System.Text.StringBuilder sb = new(max);
        for (int i = 0; i < max; i++)
        {
            sb.Append('a');
        }
        avatar = sb.ToString();

        // save
        await sessionStorage.SetAsync("avatar", avatar);

        // load it
        var data = await sessionStorage.GetAsync<string>("avatar");
        if (data.Success)
        {
            avatar = data.Value;
        }
    }
}

I tested and found that if I save a string larger than 24445, the program freezes when reading the session variable

Exceptions (if any)

No response

.NET Version

7

Anything else?

No response

@dotnet-issue-labeler dotnet-issue-labeler bot added the area-dataprotection Includes: DataProtection label Apr 28, 2023
@Oguidan
Copy link

Oguidan commented Apr 28, 2023

don't have the same same problem. Create a new one project.

@Oguidan
Copy link

Oguidan commented Apr 28, 2023

What is funny

@tossnet
Copy link
Author

tossnet commented Apr 28, 2023

What is funny

you can imagine that I tested this directly in a new project before coming to ask my problem ;)

@tossnet tossnet closed this as completed Apr 28, 2023
@ghost ghost locked as resolved and limited conversation to collaborators May 28, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-dataprotection Includes: DataProtection
Projects
None yet
Development

No branches or pull requests

2 participants