Skip to content
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

[release/9.0] [Blazor] Invoke inbound activity handlers on circuit initialization #57678

Merged
merged 2 commits into from
Sep 5, 2024

Conversation

github-actions[bot]
Copy link
Contributor

@github-actions github-actions bot commented Sep 3, 2024

Backport of #57557 to release/9.0

[Blazor] Invoke inbound activity handlers on circuit initialization

Fixes an issue where inbound activity handlers don't get invoked on circuit initialization.

Note

This bug only affects Blazor Server apps, not Blazor Web apps utilizing server interactivity

Description

Inbound activity handlers were added in .NET 8 to enable:

However, prior to the fix in this PR, this feature didn't apply to the first interactive render after the initial page load. This means that when utilizing this feature to access Blazor services from a different DI scope, the service might only become accessible after subsequent renders, not the initial render.

This PR makes the following changes:

  • Updated CircuitHost to invoke inbound activity handlers on circuit initialization
  • Added an extra test to verify that inbound activity handlers work on the initial page load
  • Updated existing Blazor Web tests to reuse test logic from the non-web tests
    • This helps to ensure that the feature works the same way on Blazor Server and Blazor Web

Fixes #57481

Customer Impact

The initial issue report was from a customer who was impacted experiencing this problem in their app. The problem does not inherently cause an app to stop working, but if the application code has made the (rightful) assumption that the service accessor is initialized, then session may crash. The workaround is to upgrade the app to use the "Blazor Web App" pattern, although this can be a fairly large change.

Regression?

  • Yes
  • No

The problem has existed since the introduction of the feature in .NET 8.

Risk

  • High
  • Medium
  • Low

The change is straightforward, and new tests have been added to ensure that it addresses the issue. Existing tests verify that a new regression is not introduced.

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 3, 2024 18:44
@dotnet-issue-labeler dotnet-issue-labeler bot added the area-blazor Includes: Blazor, Razor Components label Sep 3, 2024
@MackinnonBuck MackinnonBuck added the ask-mode This issue / PR is a patch candidate which we will bar-check internally before patching it. label Sep 3, 2024
@mkArtakMSFT mkArtakMSFT added the Servicing-consider Shiproom approval is required for the issue label Sep 4, 2024
@mkArtakMSFT mkArtakMSFT added this to the 9.0-rc2 milestone Sep 4, 2024
@mkArtakMSFT mkArtakMSFT removed the Servicing-consider Shiproom approval is required for the issue label Sep 4, 2024
@dotnet dotnet deleted a comment from dotnet-policy-service bot Sep 4, 2024
@mkArtakMSFT mkArtakMSFT added Servicing-approved Shiproom has approved the issue and removed ask-mode This issue / PR is a patch candidate which we will bar-check internally before patching it. labels Sep 5, 2024
@mkArtakMSFT
Copy link
Member

@MackinnonBuck this got approved for both 9.0 as well as 8.0. Please prepare the 8.0 PR too.

@mkArtakMSFT mkArtakMSFT merged commit 07da560 into release/9.0 Sep 5, 2024
25 checks passed
@mkArtakMSFT mkArtakMSFT deleted the backport/pr-57557-to-release/9.0 branch September 5, 2024 17:18
@dotnet-policy-service dotnet-policy-service bot modified the milestone: 9.0-rc2 Sep 5, 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 Servicing-approved Shiproom has approved the issue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants