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/8.0] [Blazor] Invoke inbound activity handlers on circuit initialization #57715

Merged
merged 2 commits into from
Sep 13, 2024

Conversation

github-actions[bot]
Copy link
Contributor

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

Backport of #57557 to release/8.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 5, 2024 17:11
@dotnet-issue-labeler dotnet-issue-labeler bot added the area-blazor Includes: Blazor, Razor Components label Sep 5, 2024
@dotnet-policy-service dotnet-policy-service bot added this to the 8.0.x milestone Sep 5, 2024
@MackinnonBuck MackinnonBuck added ask-mode This issue / PR is a patch candidate which we will bar-check internally before patching it. Servicing-approved Shiproom has approved the issue labels Sep 5, 2024
@mkArtakMSFT mkArtakMSFT removed the ask-mode This issue / PR is a patch candidate which we will bar-check internally before patching it. label Sep 5, 2024
@mkArtakMSFT mkArtakMSFT enabled auto-merge (squash) September 5, 2024 17:20
@dotnet-policy-service dotnet-policy-service bot added the pending-ci-rerun When assigned to a PR indicates that the CI checks should be rerun label Sep 12, 2024
@mkArtakMSFT mkArtakMSFT merged commit 30ef19c into release/8.0 Sep 13, 2024
25 checks passed
@mkArtakMSFT mkArtakMSFT deleted the backport/pr-57557-to-release/8.0 branch September 13, 2024 21:00
@dotnet-policy-service dotnet-policy-service bot modified the milestones: 8.0.x, 8.0.9 Sep 13, 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 pending-ci-rerun When assigned to a PR indicates that the CI checks should be rerun Servicing-approved Shiproom has approved the issue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants