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

Serialization for Blazor 10 app state store/restore capability #59489

Closed
1 task done
rockfordlhotka opened this issue Dec 15, 2024 · 3 comments
Closed
1 task done

Serialization for Blazor 10 app state store/restore capability #59489

rockfordlhotka opened this issue Dec 15, 2024 · 3 comments
Labels
area-blazor Includes: Blazor, Razor Components ✔️ Resolution: Duplicate Resolved as a duplicate of another issue Status: Resolved

Comments

@rockfordlhotka
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Is your feature request related to a problem? Please describe the problem.

No response

Describe the solution you'd like

As you look at .NET 10 and the ability to store and restore application state if the circuit goes away, please keep in mind that not all data can be serialized via JSON.

Or to be more specific, you can serialize everything via JSON, as long as we have a hook to serialize our data into a byte[] or string that you can then put into the JSON.

In my case, I'm maintaining https://github.com/marimerllc/csla, which has its own serialization tooling. It is easy enough to convert CSLA state into a byte stream or even a string, but we'd need the Blazor API to allow us (or the app developer) to have the opportunity to use our serializer first to get the app state into a form where JSON is an option.

Additional context

No response

@dotnet-issue-labeler dotnet-issue-labeler bot added the area-blazor Includes: Blazor, Razor Components label Dec 15, 2024
@javiercn
Copy link
Member

@rockfordlhotka thanks for contacting us.

Or to be more specific, you can serialize everything via JSON, as long as we have a hook to serialize our data into a byte[] or string that you can then put into the JSON.

We already have such hooks, as long as you give us a string, we will persist it (using persistent component state). We might include APIs that allow you to do your own serialization into a buffer and restore from it directly, but the ability to serialize your state into a string and pass it on to us is already there.

@javiercn
Copy link
Member

We will be using #26794 to track changes.

@javiercn javiercn added the ✔️ Resolution: Duplicate Resolved as a duplicate of another issue label Dec 17, 2024
@rockfordlhotka
Copy link
Author

@rockfordlhotka thanks for contacting us.

Or to be more specific, you can serialize everything via JSON, as long as we have a hook to serialize our data into a byte[] or string that you can then put into the JSON.

We already have such hooks, as long as you give us a string, we will persist it (using persistent component state). We might include APIs that allow you to do your own serialization into a buffer and restore from it directly, but the ability to serialize your state into a string and pass it on to us is already there.

Excellent, thank you @javiercn

I was listening to Dan's recent interview where he was talking about this upcoming .NET 10 feature, and just wanted to make sure this was considered. Sounds like that feature is already implemented, which is exciting!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-blazor Includes: Blazor, Razor Components ✔️ Resolution: Duplicate Resolved as a duplicate of another issue Status: Resolved
Projects
None yet
Development

No branches or pull requests

2 participants