Skip to content

fix: document inherited COM interface methods#1715

Merged
jevansaks merged 1 commit into
microsoft:mainfrom
nanookclaw:fix/inherited-com-doc-comments
Jun 13, 2026
Merged

fix: document inherited COM interface methods#1715
jevansaks merged 1 commit into
microsoft:mainfrom
nanookclaw:fix/inherited-com-doc-comments

Conversation

@nanookclaw

Copy link
Copy Markdown
Contributor

Summary

Fixes #1391.

Inherited COM interface methods are re-emitted with new, but their documentation lookup used the derived interface name. That made inherited IShellDispatch2 members such as FileRun search for IShellDispatch2.FileRun, even though the docs entry belongs to the declaring base interface, IShellDispatch.FileRun.

This updates the COM interface generator to use the method metadata declaring interface only for inherited members while preserving the existing lookup key for methods declared directly on the generated interface. A focused regression test generates IShellDispatch2, checks that inherited FileRun is still emitted as new void FileRun();, and verifies it receives the same XML docs as IShellDispatch.FileRun. The test also checks a direct IShellDispatch2 method still receives documentation.

Verification

/tmp/dotnet-cswin32/dotnet test test/Microsoft.Windows.CsWin32.Tests/Microsoft.Windows.CsWin32.Tests.csproj --no-restore --filter FullyQualifiedName~COMTests.InheritedCOMInterfaceMethodsUseBaseMethodDocs

@jevansaks

Copy link
Copy Markdown
Member

@nanookclaw thanks for the contribution! Looks good, but there is a merge conflict. Could you resolve and I can approve?

@nanookclaw nanookclaw force-pushed the fix/inherited-com-doc-comments branch from c1ef703 to c1807a5 Compare June 12, 2026 12:11
@nanookclaw

Copy link
Copy Markdown
Contributor Author

Rebased on current main and force-pushed c1807a5.

Conflict resolution kept the docs fix (apiDocsKey uses the declaring interface for inherited methods) while preserving the new source-generator behavior from main that avoids redeclaring inherited interface members.

Local verification:

  • git diff --check
  • dotnet restore test/Microsoft.Windows.CsWin32.Tests/Microsoft.Windows.CsWin32.Tests.csproj
  • dotnet test test/Microsoft.Windows.CsWin32.Tests/Microsoft.Windows.CsWin32.Tests.csproj --no-restore --filter FullyQualifiedName~COMTests.InheritedCOMInterfaceMethodsUseBaseMethodDocs

@jevansaks jevansaks merged commit 4307c88 into microsoft:main Jun 13, 2026
14 checks 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.

Inherited COM methods do not have documentation comments

2 participants