Skip to content

Ability to use System.Text.Json's generated sources to improve PersistentComponentState's json read performance #40683

@ysmoradi

Description

@ysmoradi

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

PersistentComponentState's TryTakeFromJson method uses System.Text.Json's auto generated sources of JsonSerializerContext & JsonSerializable
I'd like to use something like what asp.net core web API has as followings:

services
            .AddControllers...
            .AddJsonOptions(options => options.JsonSerializerOptions.AddContext<MyAppJsonContext>());

So aspnet core web API uses MyAppJsonContext globally to improve its performance.
I'd like to use generated sources of System.Text.Json in client side to read transferred json state

Currently blazor uses JsonSerializerOptionsProvider which is internal and we can't call .AddContext() to make sure it has access to our source generator based context

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Pillar: Technical DebtPriority:1Work that is critical for the release, but we could probably ship withoutarea-blazorIncludes: Blazor, Razor ComponentsenhancementThis issue represents an ask for new feature or an enhancement to an existing onefeature-prerenderingIssues related to prerendering blazor components

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions