Skip to content

Clarify member resolution hierarchy between extension methods and default interface methods (Fixes #56626) - #56643

Open
Manish-1kumar wants to merge 2 commits into
dotnet:mainfrom
Manish-1kumar:users/manish/issue-56626-mixin-overload-resolution
Open

Manish-1kumar wants to merge 2 commits into
dotnet:mainfrom
Manish-1kumar:users/manish/issue-56626-mixin-overload-resolution

Conversation

@Manish-1kumar

@Manish-1kumar Manish-1kumar commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

Summary

This pull request addresses #56626 by reframing the explanation under Limitations of extensions in the mixins tutorial around compiler overload resolution rules and member search precedence, as suggested by maintainer @BillWagner.

Changes Made

  • Overload Resolution Order: Clarified how the compiler searches for matching members between class instance declarations, interface reference access, and extension methods.
  • Interface Reference Behavior: Explained why calling methods through an interface reference cannot resolve to class-specific implementations when the member is only defined as an extension method.
  • Virtual Dispatch for Default Interface Methods: Described how default interface implementations participate in runtime virtual method dispatch, ensuring classes can override default behaviors cleanly.
  • Microsoft Style Compliance: Applied active voice, present tense, imperative mood, and ordered list formatting (1.).

Fixes #56626


Internal previews

File Preview link
docs/csharp/advanced-topics/interface-implementation/mixins-with-default-interface-methods.md Learn preview

Build report

@dotnetrepoman dotnetrepoman Bot added this to the November 2026 milestone Nov 1, 2026
@dotnet-policy-service dotnet-policy-service Bot added dotnet-csharp/svc community-contribution Indicates PR is created by someone from the .NET community. labels Nov 1, 2026
@BillWagner
BillWagner requested a balanced review from Copilot November 24, 2026 14:36

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

The documentation inaccurately limits interface member lookup to the exact interface and implies namespace imports make extension methods available regardless of accessibility.

2 open issues
What changed in this PR

Updates the C# mixins tutorial to address #56626 by explaining how compile-time member lookup differs from runtime dispatch for default interface methods.

Changes:

  • Expands the extension-method discussion into a numbered explanation of member precedence.
  • Explains interface-typed calls and class-specific implementations.
  • Contrasts extension-method availability with default interface behavior and overrides.
File Description
docs/​csharp/​advanced-topics/​interface-implementation/​mixins-with-default-interface-methods.md Revises “Limitations of extensions” to explain member lookup and interface dispatch.

Review effort: Balanced

…ault interface methods

- Reframe member resolution around compiler overload resolution rules
- Clarify member search precedence: class instance members, interface reference access, and extension methods
- Explain virtual method dispatch for default interface implementations

Fixes dotnet#56626
@Manish-1kumar
Manish-1kumar force-pushed the users/manish/issue-56626-mixin-overload-resolution branch from 4503e4a to 634372f Compare November 30, 2026 17:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community-contribution Indicates PR is created by someone from the .NET community. dotnet-csharp/svc

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve description of limitations of extensions

2 participants