Skip to content

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Aug 6, 2025

This change adds a cache-busting query parameter to the dotnet.js import statement in the Blazor WebAssembly platform code to ensure browsers don't use cached versions from previous .NET releases when upgrading to .NET 8.0.

Problem

When .NET 8.0 is released, browsers may continue to use cached versions of dotnet.js from previous .NET versions, potentially causing compatibility issues or preventing users from getting the latest runtime improvements.

Solution

Modified the default source URL in MonoPlatform.ts to append ?v=8.0 to the dotnet.js URL:

// Before
let src = '_framework/dotnet.js';

// After  
let src = '_framework/dotnet.js?v=8.0';

Impact

  • Cache busting: Browsers will download fresh dotnet.js files when .NET 8.0 is deployed instead of using cached versions
  • Minimal change: Only affects the default dotnet.js loading path when no custom loadBootResource is provided
  • Backwards compatible: Custom loaders remain unaffected and can implement their own cache busting if needed
  • Surgical modification: Single line change that follows existing code patterns

The change specifically targets the scenario where the default dotnet.js loading mechanism is used, ensuring a smooth transition for users upgrading to .NET 8.0.

Fixes #63161.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@javiercn
Copy link
Member

javiercn commented Aug 6, 2025

@copilot You should do work from the release/8.0 branch and rebase the PR on top of release/8.0

@javiercn javiercn changed the base branch from main to release/8.0 August 6, 2025 21:45
@javiercn javiercn changed the base branch from release/8.0 to main August 6, 2025 21:46
@javiercn javiercn changed the base branch from main to release/8.0 August 6, 2025 21:53
@javiercn
Copy link
Member

javiercn commented Aug 6, 2025

@copilot rebase the PR on top of release/8.0

@Copilot Copilot AI changed the title [WIP] [Blazor] Consider appending a query string to the dotnet.js import statement in .NET 8.0 [Blazor] Add query string to dotnet.js import for cache busting in .NET 8.0 Aug 6, 2025
@Copilot Copilot AI requested a review from javiercn August 6, 2025 21:54
Copilot finished work on behalf of javiercn August 6, 2025 21:54
Copy link
Contributor Author

Copilot AI commented Aug 6, 2025

@copilot You should do work from the release/8.0 branch and rebase the PR on top of release/8.0

I've rebased the PR to the release/8.0 branch and adapted the cache busting implementation for the release/8.0 code structure. The change now modifies the default src variable to include the ?v=8.0 query parameter. Commit 257a8ce17

@copilot rebase the PR on top of release/8.0

Done! The PR has been rebased to release/8.0 and the cache busting implementation has been adapted for the release/8.0 branch code structure. Commit 257a8ce17

Warning

Firewall rules blocked me from connecting to one or more addresses

I tried to connect to the following addresses, but was blocked by firewall rules:

  • 11vvsblobprodcus336.vsblob.vsassets.io
    • Triggering command: node /usr/local/bin/yarn install (dns block)
  • d0svsblobprodcus381.vsblob.vsassets.io
    • Triggering command: node /usr/local/bin/yarn install (dns block)
  • frdvsblobprodcus327.vsblob.vsassets.io
    • Triggering command: node /usr/local/bin/yarn install (dns block)
  • jrqvsblobprodcus343.vsblob.vsassets.io
    • Triggering command: node /usr/local/bin/yarn install (dns block)
  • kijvsblobprodcus387.vsblob.vsassets.io
    • Triggering command: node /usr/local/bin/yarn install (dns block)
  • kmuvsblobprodcus389.vsblob.vsassets.io
    • Triggering command: /home/REDACTED/work/aspnetcore/aspnetcore//.dotnet/dotnet msbuild /m /nologo /clp:Summary /v:minimal /nr:true /warnaserror /p:TreatWarningsAsErrors=true /p:ContinuousIntegrationBuild=false /home/REDACTED/work/aspnetcore/aspnetcore/artifacts/toolset/restore.proj /t:__WriteToolsetLocation /clp:ErrorsOnly;NoSummary /p:__ToolsetLocationOutputFile=/home/REDACTED/work/aspnetcore/aspnetcore/artifacts/toolset/8.0.0-beta.25310.3.txt (dns block)
  • m6xvsblobprodcus342.vsblob.vsassets.io
    • Triggering command: node /usr/local/bin/yarn install (dns block)
  • mfjvsblobprodcus373.vsblob.vsassets.io
    • Triggering command: node /usr/local/bin/yarn install (dns block)
  • s4uvsblobprodcus326.vsblob.vsassets.io
    • Triggering command: node /usr/local/bin/yarn install (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot finished work on behalf of javiercn August 6, 2025 22:06
@javiercn javiercn closed this Aug 6, 2025
@javiercn javiercn force-pushed the copilot/fix-63161 branch from bb8c4ba to 19e799c Compare August 6, 2025 22:08
@dotnet-policy-service dotnet-policy-service bot added this to the 8.0.20 milestone Aug 6, 2025
@javiercn
Copy link
Member

javiercn commented Aug 6, 2025

@copilot re-apply the changes

@javiercn javiercn deleted the copilot/fix-63161 branch August 6, 2025 22:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Blazor] Consider appending a query string to the dotnet.js import statement in .NET 8.0

2 participants