Skip to content

CreateInboundActivityHandler override in .net 8 RC2 not being called #51934

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

Closed
1 task done
Thomas-Explc opened this issue Nov 8, 2023 · 1 comment · Fixed by #53185
Closed
1 task done

CreateInboundActivityHandler override in .net 8 RC2 not being called #51934

Thomas-Explc opened this issue Nov 8, 2023 · 1 comment · Fixed by #53185
Assignees
Labels
area-blazor Includes: Blazor, Razor Components bug This issue describes a behavior which is not expected - a bug. feature-blazor-server
Milestone

Comments

@Thomas-Explc
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

CreateInboundActivityHandler introduced in .net 8 preview 3, as seen in the dotnet blog post linked below, does not appear to work in .net 8 release candidate 2.

https://devblogs.microsoft.com/dotnet/asp-net-core-updates-in-dotnet-8-preview-3/#monitor-blazor-server-circuit-activity

Within the same circuit handler the overrides for circuit open, circuit closed, connection up and connection down work as expected.

Are there any situations which would cause the CreateInboundActivityHandler to not be called when UI events fire in an interactive server component that is functioning as expected?

Expected Behavior

The CreateInboundActivityHandler is called when any user interface events within a blazor component are activated, e.g. the changing of text, the click of a button.

Steps To Reproduce

Repo: https://github.com/Thomas-Explc/CreateInboundActivityHandler_Bug_Example

Go to counter page, use the button and enter test in the input field, no UI events cause function to fire.

Logger in CreateInboundActivityHandler is not hit, no breakpoints within that function are reached.

Exceptions (if any)

None, issue is logical.

.NET Version

8.0.100-rc.2.23502.2

Anything else?

Visual Studio 2022, 17.8.0 Preview 6.0.

@ghost ghost added the area-blazor Includes: Blazor, Razor Components label Nov 8, 2023
@MackinnonBuck
Copy link
Member

Confirmed this is a bug, specifically for Blazor Web Apps. It's caused by the fact that in Blazor Web, the initial circuit handlers array is empty by the time the inbound activity dispatcher gets built. However, even after the Blazor Web circuit handlers are retrieved later from DI, we don't build the inbound activity handler.

The easy fix would be to call BuildInboundActivityDispatcher after the _circuitHandlers are retrieved for Blazor Web.

@MackinnonBuck MackinnonBuck removed their assignment Nov 20, 2023
@mkArtakMSFT mkArtakMSFT added the bug This issue describes a behavior which is not expected - a bug. label Nov 22, 2023
@mkArtakMSFT mkArtakMSFT added this to the 8.0.x milestone Nov 22, 2023
mkArtakMSFT pushed a commit that referenced this issue Jan 16, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
… (#53313)

# Dispatch inbound activity handlers in Blazor Web apps

Fixes an issue where inbound activity handlers were not getting invoked in Blazor Web apps.

## Description

Inbound activity handlers were a new feature introduced in .NET 8 to allow Blazor Server apps to monitor circuit activity and make services available to Blazor components that wouldn't otherwise be accessible. However, we also introduced a new "Blazor Web" app model that didn't incorporate this new feature correctly.

This PR fixes the issue by:
* Building the inbound activity pipeline in Blazor Web apps just after circuit handlers are retrieved
* Invoking inbound activity handlers in web root component updates

Fixes #51934

## Customer Impact

Multiple customers have indicated being affected by this issue. Since this is a new feature in .NET 8, customers expect it to work in Blazor Web apps, which we recommend for new projects. Without this fix, the functionality only works in traditional Blazor Server apps.

## Regression?

- [ ] Yes
- [X] No

This is a new feature in .NET 8.

## Risk

- [ ] High
- [ ] Medium
- [X] Low

The fix is simple and applies to a well-tested area of the framework, so our E2E tests are likely to catch issues with this change.

## Verification

- [X] Manual (required)
- [X] Automated

## Packaging changes reviewed?

- [ ] Yes
- [ ] No
- [X] N/A
@mkArtakMSFT mkArtakMSFT modified the milestones: 8.0.x, 8.0.2 Jan 16, 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 bug This issue describes a behavior which is not expected - a bug. feature-blazor-server
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

3 participants