Skip to content

Comments

Restore SuppressGCTransition handling#122904

Merged
jkoritzinsky merged 1 commit intodotnet:mainfrom
jkoritzinsky:suppress-gc-fix
Jan 6, 2026
Merged

Restore SuppressGCTransition handling#122904
jkoritzinsky merged 1 commit intodotnet:mainfrom
jkoritzinsky:suppress-gc-fix

Conversation

@jkoritzinsky
Copy link
Member

Fixes #122762

Copy link
Contributor

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 a bug where SuppressGCTransitionAttribute was not being applied to PInvoke methods that have an explicit unmanaged calling convention set via metadata flags (e.g., Cdecl, StdCall, ThisCall). The fix moves the attribute check from inside a conditional block (where it only executed for EcmaMethod instances) to after the entire conditional structure, ensuring it applies to all PInvoke methods regardless of how their calling convention is determined.

Key Changes

  • Moved SuppressGCTransitionAttribute check outside the else if (method is EcmaMethod ecmaMethod) block
  • The attribute is now checked unconditionally for all PInvoke methods, not just those without explicit calling convention metadata

@jkotas
Copy link
Member

jkotas commented Jan 6, 2026

/ba-g deadletter

@jkoritzinsky jkoritzinsky merged commit 6707b81 into dotnet:main Jan 6, 2026
102 of 107 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Feb 5, 2026
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.

Test failure: Interop/SuppressGCTransition/SuppressGCTransitionTest/SuppressGCTransitionTest.cmd

2 participants