Skip to content

Conversation

@oroztocil
Copy link
Member

@oroztocil oroztocil commented Dec 2, 2025

  • Adds a new property cache to the definition of browser assets that allows specifying caching behavior when fetching the asset.
  • Updates the boot JSON data builder to use "force-cache" setting for fingerprinted assets. This logic utilizes the fact that fingerprinted assets can always be used from cache without re-validation on the server.
  • Updates logic in the Wasm asset loader to use the new cache setting if set. If not set, previous behavior is kept as fallback (i.e. "no-cache" is used unless disabled by user).

These changes are intended to mitigate the regression in Blazor WebAssembly loading performance introduced in .NET 10 due to the removal of the custom asset cache.

Adds a new E2E test that checks that no requests are sent to the server for fingerprinted Wasm assemblies on subsequent page reloads. A new Blazor Web application sample is added to support this test.

Contributes to dotnet/aspnetcore#64009

@github-actions github-actions bot added the needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners label Dec 2, 2025
@oroztocil oroztocil force-pushed the oroztocil/asset-caching-fix branch from 047ba0c to 3c3fb14 Compare December 2, 2025 16:20
@oroztocil oroztocil force-pushed the oroztocil/asset-caching-fix branch from dbc5c27 to 52be9e4 Compare December 5, 2025 03:05
@oroztocil oroztocil force-pushed the oroztocil/asset-caching-fix branch from af0bdee to 0012254 Compare December 9, 2025 21:01
@oroztocil oroztocil added arch-wasm WebAssembly architecture os-browser Browser variant of arch-wasm and removed needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners labels Dec 9, 2025
@oroztocil oroztocil marked this pull request as ready for review December 9, 2025 22:46
Copilot AI review requested due to automatic review settings December 9, 2025 22:46
Copy link
Member

@javiercn javiercn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@oroztocil oroztocil changed the title Disable adding "no-cache" header for fingerprinted Wasm asssets Add cache setting to asset definition, use "force-cache" for fingerprinted assets Dec 10, 2025
@maraf

This comment was marked as outdated.

@github-actions

This comment was marked as outdated.

@github-actions

This comment was marked as outdated.

@maraf
Copy link
Member

maraf commented Dec 11, 2025

The test case on main won't work, because that current state of Wasm.Build.Tests is

  • We can't target .NET 11
  • When targeting .NET 10, we get a "default" packs contained in the SDK instead of the built ones from changes in the branch

lewing pushed a commit that referenced this pull request Dec 11, 2025
…e" for fingerprinted assets (#122442)

Backport of #122101 to
release/10.0 to fix dotnet/aspnetcore#64009

## Customer Impact

- [x] Customer reported
- [ ] Found internally

The issue significantly effects startup time of every WebAssembly based
application.

## Regression

- [x] Yes
- [ ] No

Caused by #114901

## Testing

Manual testing of Blazor WebAssembly standalone, Blazor Web with
WebAssembly & Auto interactivity, with Chromium-based, Firefox and
Safari.
Automated test.

## Risk

Low. We are changing both built-time generator and runtime part reading
the values. Thanks to fingerprinting there isn't a room for some
staleness of one part. The change is scoped and in case it won't work in
some scenario, the workaround is still possible.

---------

Co-authored-by: Ondrej Roztocil <roztocil@outlook.com>
@maraf maraf enabled auto-merge (squash) December 12, 2025 09:02
@maraf maraf merged commit bed0cad into main Dec 12, 2025
32 of 34 checks passed
@maraf maraf deleted the oroztocil/asset-caching-fix branch December 12, 2025 13:11
@github-actions github-actions bot locked and limited conversation to collaborators Jan 12, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

arch-wasm WebAssembly architecture os-browser Browser variant of arch-wasm

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants