Skip to content

Conversation

jtschuster
Copy link
Member

@jtschuster jtschuster commented Jan 28, 2025

Fixes cross-assembly interface inheritance.

Deduplicate external ComInterfaceInfos in the pipeline.

Don't remove external interface methods in the generator pipeline - these are required to create the new VTable struct type introduced in #116289.

Creates a new SourceAvailableIncrementalMethodStubGenerationContext for methods with source available and use IncrementalMethodStubGenerationContext as a base for externally defined methods.

Moves the ComInterfaces from SharedTypes to the Common folder, and defines a limited set of base interfaces in SharedTypes for interfaces in ComInterfaceGenerator to derived from. Adds a number of tests for different levels of inheritance across assemblies.

@AaronRobinsonMSFT AaronRobinsonMSFT added the NO-MERGE The PR is not ready for merge yet (see discussion for detailed reasons) label Jan 30, 2025
Copilot

This comment was marked as outdated.

Copilot

This comment was marked as outdated.

@jtschuster jtschuster requested a review from Copilot July 28, 2025 19:27
Copy link
Contributor

@Copilot 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 cross-assembly interface inheritance in the COM interface generator by properly handling external interface references and enabling deduplication of base interfaces from other assemblies. The key changes include refactoring the generation context hierarchy, moving shared interfaces to a common location, and adding comprehensive tests for cross-assembly inheritance scenarios.

Key changes:

  • Adds deduplication of external ComInterfaceInfos to prevent duplicate processing of base interfaces
  • Creates new context classes to separate source-available from sourceless method generation
  • Moves shared COM interfaces from TestAssets/SharedTypes to Common folder for better organization

Reviewed Changes

Copilot reviewed 25 out of 72 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
SharedTypes.csproj Removes code generation exclusion to enable proper interface inheritance testing
IExternalBase.cs / IExternalDerived.cs Adds base COM interfaces for cross-assembly inheritance testing
CrossAssemblyInheritanceTests.cs Comprehensive test suite validating VTable layout consistency across assemblies
ComInterfaceGenerator.cs Implements external interface deduplication and refactors stub generation logic
IncrementalMethodStubGenerationContext.cs Creates inheritance hierarchy for source-available vs. sourceless contexts
ComInterfaceInfo.cs Adds equality comparer for external interface deduplication

@jtschuster jtschuster removed the NO-MERGE The PR is not ready for merge yet (see discussion for detailed reasons) label Jul 30, 2025
@jtschuster jtschuster merged commit 2d7c63b into dotnet:main Jul 31, 2025
93 of 94 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Aug 31, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants