Don't report a interp->native transition when it is done from a pinvoke method#127660
Merged
BrzVlad merged 1 commit intodotnet:mainfrom May 2, 2026
Merged
Conversation
…ke method We didn't report these transitions when they were triggered from ILStubs because they already explicitly do this. Following the change of using transient IL belonging to the actual PInvoke method rather than separate ILStub methods (which should contain the same logic as the ILStub used to), we would now report the same event twice. We need therefore to also ignore the case where we are doing a PInvoke call from an actual PInvoke method. Fixes src/tests/profiler/transitions/transitions.csproj.
Member
Author
|
/azp run runtime-interpreter |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Contributor
|
Tagging subscribers to this area: @JulieLeeMSFT, @BrzVlad, @janvorli, @kg |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adjusts CoreCLR interpreter profiling transition reporting to avoid double-counting managed↔unmanaged transition events when the interpreter executes transient-IL-backed P/Invoke methods (post-#126509). This restores expected behavior for profiler transition tests by suppressing interpreter-side transition callbacks in cases where the P/Invoke body already performs the transition notifications.
Changes:
- Suppress
ProfilerManagedToUnmanagedTransitionMD/ProfilerUnmanagedToManagedTransitionMDcallbacks in the interpreter calli-with-transition path when the currently interpreted method is a P/Invoke. - Preserve the existing suppression for IL stubs, extending it to P/Invoke methods now that the transient IL is attributed to the P/Invoke MethodDesc.
jkoritzinsky
approved these changes
May 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
We didn't report these transitions when they were triggered from ILStubs because they already explicitly do this. Following the change of using transient IL belonging to the actual PInvoke method rather than separate ILStub methods (which should contain the same logic as the ILStub used to), we would now report the same event twice. We need therefore to also ignore the case where we are doing a PInvoke call from an actual PInvoke method.
Fixes src/tests/profiler/transitions/transitions.csproj which regressed after #126509 on interpreter.