Skip to content

Fix: detect handler methods inherited from base interfaces#11

Merged
mkholt merged 2 commits into
mainfrom
fails-to-detect-inherited-members-56d
Jun 19, 2026
Merged

Fix: detect handler methods inherited from base interfaces#11
mkholt merged 2 commits into
mainfrom
fails-to-detect-inherited-members-56d

Conversation

@mkholt

@mkholt mkholt commented Jun 19, 2026

Copy link
Copy Markdown
Member

GetAllMethodsIncludingInherited only walked the BaseType chain, which is null for interfaces. Inherited interface members are exposed via AllInterfaces, so a handler method declared on a base interface was not detected and falsely triggered XPC4001.

Also iterate AllInterfaces (transitive) so multi-level interface inheritance is covered. This fixes XPC4001, XPC4002, and the related code-fix providers, which all route through this helper.

GetAllMethodsIncludingInherited only walked the BaseType chain, which is
null for interfaces. Inherited interface members are exposed via
AllInterfaces, so a handler method declared on a base interface was not
detected and falsely triggered XPC4001.

Also iterate AllInterfaces (transitive) so multi-level interface
inheritance is covered. This fixes XPC4001, XPC4002, and the related
code-fix providers, which all route through this helper.

Co-Authored-By: Claude <noreply@anthropic.com> via Conducktor <conducktor@contextand.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes analyzer/source-generator handler method discovery for interface inheritance by ensuring methods declared on base interfaces are detected (preventing false XPC4001/XPC4002 reports).

Changes:

  • Update TypeHelper.GetAllMethodsIncludingInherited to also include methods from AllInterfaces (transitive) to cover inherited interface members.
  • Add a diagnostic test ensuring XPC4001 is not reported when the handler method comes from a base interface.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
XrmPluginCore.SourceGenerator/Helpers/TypeHelper.cs Extends method discovery to include inherited interface members via AllInterfaces.
XrmPluginCore.SourceGenerator.Tests/DiagnosticTests/DiagnosticReportingTests.cs Adds coverage for handler methods inherited from a base interface.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread XrmPluginCore.SourceGenerator/Helpers/TypeHelper.cs
…evel chain

- Only walk AllInterfaces when the input type is itself an interface, so
  FindImplementingMethods (called with class symbols) no longer surfaces
  unimplemented interface declaration methods.
- Extend the regression test to a multi-level interface chain
  (ITestService : IMidService : IBaseService) to lock in the transitive
  AllInterfaces behavior.

Co-Authored-By: Claude <noreply@anthropic.com> via Conducktor <conducktor@contextand.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.

@mkholt mkholt merged commit d14d6dc into main Jun 19, 2026
2 checks passed
@mkholt mkholt deleted the fails-to-detect-inherited-members-56d branch June 19, 2026 12:49
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.

2 participants