Skip to content

Remove ClassSupportsIClassX which always returns true - #131683

Merged
elinor-fung merged 4 commits into
mainfrom
copilot/clean-up-classsupportsiclassx
Aug 4, 2026
Merged

Remove ClassSupportsIClassX which always returns true#131683
elinor-fung merged 4 commits into
mainfrom
copilot/clean-up-classsupportsiclassx

Conversation

Copilot AI commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

ClassSupportsIClassX was a stub that unconditionally returned TRUE, making all call sites either dead code or no-ops. Removes the function and simplifies the call sites. This also mean enum_SupportsIClassX was always set for classes - removed it and SupportsIClassX().

Co-authored-by: elinor-fung <47805090+elinor-fung@users.noreply.github.com>

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.

Copilot was unable to review this pull request because there is no eligible user to bill. To allow Copilot reviews on bot-authored pull requests, enable direct organization billing in your organization's Copilot settings.

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 3 pipeline(s).
13 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @dotnet/interop-contrib
See info in area-owners.md if you want to be subscribed.

@elinor-fung
elinor-fung marked this pull request as ready for review July 31, 2026 23:24
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 3 pipeline(s).
13 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

@jkoritzinsky

Copy link
Copy Markdown
Member

@copilot can we remove enum_SupportsIClassX and adjust the code paths that check it to take the "is set" branch if it's set unconditionally?

Co-authored-by: jkoritzinsky <1571408+jkoritzinsky@users.noreply.github.com>
Copilot AI review requested due to automatic review settings July 31, 2026 23:46

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.

Copilot was unable to review this pull request because there is no eligible user to bill. To allow Copilot reviews on bot-authored pull requests, enable direct organization billing in your organization's Copilot settings.

Copilot AI commented Jul 31, 2026

Copy link
Copy Markdown
Contributor Author

@copilot can we remove enum_SupportsIClassX and adjust the code paths that check it to take the "is set" branch if it's set unconditionally?

Done in commit that follows on this PR. Removed enum_SupportsIClassX and SupportsIClassX() entirely, and simplified all call sites to take the "is set" branch unconditionally:

  • GetBasicIP() now directly returns GetIClassXIP(inspectionOnly) (the rest of the function was dead code)
  • All if (pTemplate->SupportsIClassX()) / if (pIntfCCWTemplate->SupportsIClassX()) guards removed in comcallablewrapper.cpp, interoputil.cpp, and stdinterfaces.cpp
  • The two PRECONDITION(SupportsIClassX()) assertions removed from GetClassComMT() and CreateComMethodTableForClass()
  • The flag-setting pTemplate->m_flags |= enum_SupportsIClassX removed from CreateTemplate()

Note

This response was generated by GitHub Copilot.

Comment thread src/coreclr/vm/stdinterfaces.cpp Outdated
Co-authored-by: elinor-fung <47805090+elinor-fung@users.noreply.github.com>

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.

Copilot's findings

  • Files reviewed: 6/6 changed files
  • Comments generated: 0 new

Comment thread src/coreclr/vm/stdinterfaces.cpp
Co-authored-by: AaronRobinsonMSFT <30635565+AaronRobinsonMSFT@users.noreply.github.com>
Copilot AI review requested due to automatic review settings August 3, 2026 23:03
Copilot AI requested a review from AaronRobinsonMSFT August 3, 2026 23:04

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.

Copilot's findings

Suppressed comments (1)

src/coreclr/vm/comcallablewrapper.cpp:3608

  • GetClassComMT() can only create a class COM method table (CreateComMethodTableForClass has a !IsInterface() precondition). With SupportsIClassX removed, it would be good to keep an explicit contract precondition here to catch accidental calls on interface templates closer to the source.
    CONTRACTL
    {
        THROWS;
        GC_TRIGGERS;
        MODE_ANY;
    }
  • Files reviewed: 6/6 changed files
  • Comments generated: 0 new

@AaronRobinsonMSFT

Copy link
Copy Markdown
Member

@jkoritzinsky Can you please review this. My signoff is likely invalid now.

@elinor-fung
elinor-fung merged commit 80a98f8 into main Aug 4, 2026
109 of 111 checks passed
@elinor-fung
elinor-fung deleted the copilot/clean-up-classsupportsiclassx branch August 4, 2026 05:26
@github-project-automation github-project-automation Bot moved this to Done in AppModel Aug 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

5 participants