Skip to content

[release/9.0] [Blazor] Fix custom elements JS assets not being included in build output #60858

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 11, 2025

Conversation

MackinnonBuck
Copy link
Member

@MackinnonBuck MackinnonBuck commented Mar 10, 2025

Fix custom elements JS assets not being included in build output

This update addresses an issue where JS assets providing functionality for the Microsoft.AspNetCore.Components.CustomElements package were not correctly built, causing the extension method RootComponentMappingCollection.RegisterCustomElement() to throw an exception.

Description

The MSBuild logic to include JS assets in the Microsoft.AspNetCore.Components.CustomElements package stopped working because the target that adds JS assets started running too late in the build process (after the ResolveJSModuleStaticWebAssets target). Although the reasons for the change in target ordering are unknown, the fix is to explicitly run the target before ResolveJSModuleStaticWebAssets.

This bug was discovered during the investigation of failures in our automated Blazor E2E tests.

Fixes #60859

Customer Impact

If this bug is left unfixed, calls to RegisterCustomElement() will throw an exception, preventing Blazor WebAssembly functionality from working. In a Blazor Web App, this may cause partial or complete loss of app functionality, and in Blazor WebAssembly apps, complete loss of app functionality.

However, note that this issue would only affect Blazor apps using the Microsoft.AspNetCore.Components.CustomElements package. The primary purpose of the package is to expose Blazor components as custom elements that can be rendered from a JavaScript-based UI library.

We don't have any customer data on the bug because a version of the package with the bug has not shipped. Version 9.0.3 would have included the bug, so we're going to skip shipping version 9.0.3 of this package and get this bug fixed for version 9.0.4.

Regression?

  • Yes
  • No

Regressed from Microsoft.AspNetCore.Components.CustomElements version 9.0.2.

Risk

  • High
  • Medium
  • Low

The fix is simple and was applied back in October 2024 on the main branch.

Verification

  • Manual (required)
  • Automated

Automated E2E tests caught this bug an SDK update PR targeting main because the components-e2e pipeline is a required check in main. However, since that pipeline was not required for release branches, this issue slipped through the cracks for release/9.0. This has been fixed, and the components-e2e pipeline is now a required check for release branches.

Packaging Changes Reviewed?

  • Yes
  • No
  • N/A

@Copilot Copilot AI review requested due to automatic review settings March 10, 2025 21:39
@MackinnonBuck MackinnonBuck requested a review from a team as a code owner March 10, 2025 21:39
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot reviewed 1 out of 1 changed files in this pull request and generated no comments.

@dotnet-issue-labeler dotnet-issue-labeler bot added the area-blazor Includes: Blazor, Razor Components label Mar 10, 2025
@dotnet-policy-service dotnet-policy-service bot added this to the 9.0.x milestone Mar 10, 2025
@wtgodbe wtgodbe added the tell-mode Indicates a PR which is being merged during tell-mode label Mar 10, 2025
@MackinnonBuck MackinnonBuck added Servicing-consider Shiproom approval is required for the issue and removed tell-mode Indicates a PR which is being merged during tell-mode labels Mar 10, 2025
@wtgodbe wtgodbe added Servicing-approved Shiproom has approved the issue and removed Servicing-consider Shiproom approval is required for the issue labels Mar 11, 2025
@wtgodbe
Copy link
Member

wtgodbe commented Mar 11, 2025

Approved over email

@wtgodbe wtgodbe merged commit cd7e571 into release/9.0 Mar 11, 2025
25 checks passed
@wtgodbe wtgodbe deleted the mbuck/fix-custom-elements branch March 11, 2025 01:48
@dotnet-policy-service dotnet-policy-service bot modified the milestones: 9.0.x, 9.0.4 Mar 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-blazor Includes: Blazor, Razor Components Servicing-approved Shiproom has approved the issue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants