Skip to content

Conversation

github-actions[bot]
Copy link
Contributor

@github-actions github-actions bot commented Sep 10, 2025

Script tag helper ask mode PR content

Backport of #63155 to release/10.0

/cc @MackinnonBuck @copilot

Fix ScriptTagHelper regression by checking for existing content before processing importmaps

Preserves developer-provided content in the <script> tag helper when its type is "importmap".

Description

In .NET 9, we updated the <script> tag helper to automatically include an import map for fingerprinted JavaScript assets when its type attribute was set to "importmap".

However, if the app had been specifying import map content explicitly, then that content would get overridden by the updated tag helper logic.

This fix changes ScriptTagHelper to preserve the any developer-specified import map content.

Fixes #58973

Customer Impact

This bug impacts customers upgrading to .NET 9 or 10 from .NET 8. The linked issue has notable community engagement which indicates that many customers are affected by this break.

There is a workaround, which is to use the following syntax to bypass the tag helper:

<!script type="importmap">...</!script>

Regression?

  • Yes
  • No

Regressed in .NET 9

Risk

  • High
  • Medium
  • Low

The fix is straightforward and has been validated via both automated and manual testing.

Verification

  • Manual (required)
  • Automated

Packaging changes reviewed?

  • Yes
  • No
  • N/A

@github-actions github-actions bot requested a review from a team as a code owner September 10, 2025 22:12
@danmoseley danmoseley added the Servicing-approved Shiproom has approved the issue label Sep 10, 2025
@danmoseley
Copy link
Member

several customers reported this, upgrade impediment from .NET 8, limited risk. approved

@MackinnonBuck
Copy link
Member

@wtgodbe, the build is failing because this technically changes the public API of ScriptTagHelper by removing and adding an override. Since this isn't technically a breaking API change, do you think it's fine if we bypass the API baseline check?

@joperezr
Copy link
Member

Since this isn't technically a breaking API chang

Was the original API added in 10? If so, is there a way to just fix the api txt files so this doesn't trigger? Separate, but I'm assuming we are going to (if we haven't already) add this to the breaking changes list for RC2?

@MackinnonBuck
Copy link
Member

Was the original API added in 10?

The removed override has been shipping since before .NET 10.

Separate, but I'm assuming we are going to (if we haven't already) add this to the breaking changes list for RC2?

I'm pretty sure this isn't a breaking change (even though the API is changing), as the removed override is still defined on the base type. Maybe I'm mistaken about this not being a breaking change, but this suggests it's allowed.

@wtgodbe wtgodbe merged commit 2fbe331 into release/10.0 Sep 12, 2025
25 of 28 checks passed
@wtgodbe wtgodbe deleted the backport/pr-63155-to-release/10.0 branch September 12, 2025 16:04
@dotnet-policy-service dotnet-policy-service bot added this to the 10.0-rc2 milestone Sep 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Servicing-approved Shiproom has approved the issue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants