Skip to content

Conversation

@paulomorgado
Copy link
Contributor

Support HubMethodNameAttribute inheritance for DefaultHubDispatcher

  • You've read the Contributor Guide and Code of Conduct.
  • You've included unit or integration tests for your change, where applicable.
  • You've included inline docs for your change, where applicable.
  • There's an open issue for the PR that you are making. If you'd like to propose a new feature or change, please open an issue to discuss the change or find an existing issue.

Fixes #64291

Copilot AI review requested due to automatic review settings December 19, 2025 09:03
@github-actions github-actions bot added the area-signalr Includes: SignalR clients and servers label Dec 19, 2025
@dotnet-policy-service dotnet-policy-service bot added the community-contribution Indicates that the PR has been added by a community member label Dec 19, 2025
@dotnet-policy-service
Copy link
Contributor

Thanks for your PR, @@paulomorgado. Someone from the team will get assigned to your PR shortly and we'll get it reviewed.

Copy link
Contributor

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.

Pull request overview

This PR adds support for inheriting the HubMethodNameAttribute in the DefaultHubDispatcher by modifying the attribute lookup to use inherit: true. This change ensures that when a hub method in a derived class overrides a base class method that has a HubMethodNameAttribute, the attribute is properly inherited.

  • Modified GetCustomAttribute<HubMethodNameAttribute> to use inherit: true parameter, making it consistent with how AuthorizeAttribute is already handled
  • Added comprehensive test coverage for [FromService] attribute functionality with various parameter combinations
  • Reorganized and added hub test methods in ServicesHub to support the new tests

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
src/SignalR/server/Core/src/Internal/DefaultHubDispatcher.cs Added inherit: true parameter to GetCustomAttribute<HubMethodNameAttribute> call to enable attribute inheritance from base classes
src/SignalR/server/SignalR/test/Microsoft.AspNetCore.SignalR.Tests/HubConnectionHandlerTests.cs Added 10 new test methods for [FromService] attribute scenarios and reorganized using statements
src/SignalR/server/SignalR/test/Microsoft.AspNetCore.SignalR.Tests/HubConnectionHandlerTestUtils/Hubs.cs Added and reorganized hub methods in ServicesHub to support testing of service injection with attributes

…ests/HubConnectionHandlerTests.cs

Co-authored-by: Copilot <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-signalr Includes: SignalR clients and servers community-contribution Indicates that the PR has been added by a community member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Consider allowing hinheriting HubMethodNameAttribute in SignalR hub classes

1 participant