Skip to content

[release/8.0] [Blazor] Fix misdetection of component comments #52744

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 2 commits into from
Jan 10, 2024

Conversation

MackinnonBuck
Copy link
Member

@MackinnonBuck MackinnonBuck commented Dec 11, 2023

Fix misdetection of component comments

Backport of #52647

Fixes an issue where in certain cases, SSR updates fail to apply to the page. This results browser errors which may cause parts of the app to lose functionality.

Description

Under the hood, Blazor uses HTML comments to store component metadata in the DOM. When an SSR update occurs, those comments help indicate which HTML elements are associated with a component. However, one aspect of the enhanced navigation/streaming rendering logic was sometimes misinterpreting ordinary HTML comments as Blazor component comments, causing an error to be thrown. This edge case doesn't occur often, but the error can be reproduced fairly consistently if:

  1. An app has an interactive component in the top level of its layout, then...
  2. the user refreshes the browser while on a page with streaming enabled, then...
  3. the user navigates to another page via enhanced navigation.

This PR fixes the issue by correcting the logic that sometimes misinterprets non-component comments as component comments.

Fixes #52126

Customer Impact

Customers with interactive components in the top level of their app's layout are likely to encounter this bug. This seems to be a somewhat common pattern - we've seen multiple customers in the linked issue indicate that they're affected by this bug. When the bug occurs, it may cause parts of the app to stop working; components may not become interactive and link clicks may not do anything.

Regression?

  • Yes
  • No

This is a bug in streaming rendering and enhanced navigation, which are features that were introduced in .NET 8. The bug has existed for as long as SSR updates have been allowed to add, update, and remove interactive components.

Risk

  • High
  • Medium
  • Low

The change to this particular piece of code is fairly straightforward to reason about, and we have a new E2E test for the exact scenario that produced the error.

Verification

  • Manual (required)
  • Automated

Packaging changes reviewed?

  • Yes
  • No
  • N/A

@MackinnonBuck MackinnonBuck added Servicing-consider Shiproom approval is required for the issue area-blazor Includes: Blazor, Razor Components labels Dec 11, 2023
@MackinnonBuck MackinnonBuck requested a review from a team as a code owner December 11, 2023 19:53
@ghost
Copy link

ghost commented Dec 11, 2023

Hi @MackinnonBuck. Please make sure you've updated the PR description to use the Shiproom Template. Also, make sure this PR is not marked as a draft and is ready-to-merge.

To learn more about how to prepare a servicing PR click here.

@ghost ghost added this to the 8.0.x milestone Dec 11, 2023
@ghost
Copy link

ghost commented Dec 11, 2023

Hi @MackinnonBuck. If this is not a tell-mode PR, please make sure to follow the instructions laid out in the servicing process document.
Otherwise, please add tell-mode label.

@mkArtakMSFT mkArtakMSFT added Servicing-approved Shiproom has approved the issue and removed Servicing-consider Shiproom approval is required for the issue labels Dec 12, 2023
@ghost
Copy link

ghost commented Dec 12, 2023

Hi @MackinnonBuck. This PR was just approved to be included in the upcoming servicing release. Somebody from the @dotnet/aspnet-build team will get it merged when the branches are open. Until then, please make sure all the CI checks pass and the PR is reviewed.

@ghost
Copy link

ghost commented Dec 20, 2023

Looks like this PR hasn't been active for some time and the codebase could have been changed in the meantime.
To make sure no conflicting changes have occurred, please rerun validation before merging. You can do this by leaving an /azp run comment here (requires commit rights), or by simply closing and reopening.

@ghost ghost added the pending-ci-rerun When assigned to a PR indicates that the CI checks should be rerun label Dec 20, 2023
@wtgodbe wtgodbe removed the pending-ci-rerun When assigned to a PR indicates that the CI checks should be rerun label Jan 3, 2024
@ghost ghost added the area-infrastructure Includes: MSBuild projects/targets, build scripts, CI, Installers and shared framework label Jan 3, 2024
@wtgodbe
Copy link
Member

wtgodbe commented Jan 3, 2024

@MackinnonBuck can you fix the merge conflict?

@wtgodbe
Copy link
Member

wtgodbe commented Jan 4, 2024

@MackinnonBuck are the test failures related?

@MackinnonBuck
Copy link
Member Author

/azp run

Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@wtgodbe
Copy link
Member

wtgodbe commented Jan 9, 2024

/azp run

@wtgodbe wtgodbe enabled auto-merge (squash) January 9, 2024 20:42
Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@wtgodbe
Copy link
Member

wtgodbe commented Jan 10, 2024

Test failures are unrelated

@wtgodbe wtgodbe merged commit 158d048 into release/8.0 Jan 10, 2024
@wtgodbe wtgodbe deleted the mbuck/backport-52647-to-8.0 branch January 10, 2024 23:00
@ghost ghost removed this from the 8.0.x milestone Jan 10, 2024
@ghost ghost added this to the 8.0.2 milestone Jan 10, 2024
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 area-infrastructure Includes: MSBuild projects/targets, build scripts, CI, Installers and shared framework Servicing-approved Shiproom has approved the issue
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

4 participants