Skip to content

Improve Blazor WebAssembly AOT: trimming, reflection, System.Text.Json, and third-party library support #64802

@sardar97

Description

@sardar97

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.

Blazor WebAssembly AOT is promising, but in real-world production apps:

  • Reflection breaks AOT builds (generic components, dynamic model binding, validators, etc.)
  • System.Text.Json relies heavily on reflection and requires manual source generators
  • Trimming is fragile and runtime failures often occur only in the browser
  • Third-party libraries like Syncfusion and MudBlazor have insufficient trimming documentation

These issues make it hard to use AOT safely in production.

Describe the solution you'd like

  1. Better automatic reflection analysis for components
  2. Default Blazor-friendly JSON source generation
  3. Build-time diagnostics for trimmed types/members
  4. Clear trimming guidance and examples for third-party libraries
  5. Official AOT + trimming presets (Conservative / Balanced / Aggressive)

Additional context

Improving these areas would make AOT more reliable, reduce runtime errors, and encourage production adoption of Blazor WASM AOT.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions