Skip to content

Comments

fix: Allow non-static CustomHandler method if scan method is non-static#40

Merged
Dreamescaper merged 1 commit intomainfrom
allow-instance-custom-handler
Jul 31, 2025
Merged

fix: Allow non-static CustomHandler method if scan method is non-static#40
Dreamescaper merged 1 commit intomainfrom
allow-instance-custom-handler

Conversation

@Dreamescaper
Copy link
Owner

No description provided.

@Dreamescaper Dreamescaper requested a review from Copilot July 31, 2025 16:22
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 fixes a restriction that prevented non-static CustomHandler methods from being used in service registration generation. The change allows instance methods to be used as CustomHandler when the scan method itself is non-static.

  • Updates diagnostic message to remove the "static" requirement for CustomHandler methods
  • Removes the static method constraint when searching for CustomHandler methods
  • Adds test coverage for using instance CustomHandler methods

Reviewed Changes

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

File Description
DiagnosticDescriptors.cs Updates error message to remove static requirement
DependencyInjectionGenerator.ParseMethodModel.cs Removes static constraint from CustomHandler method lookup
CustomHandlerTests.cs Adds test for instance CustomHandler method functionality

@Dreamescaper Dreamescaper merged commit 832a415 into main Jul 31, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant