Conversation
|
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. |
Contributor
|
Tagging subscribers to this area: @JulieLeeMSFT, @BrzVlad, @janvorli |
Contributor
|
Tagging subscribers to 'os-maccatalyst': @vitek-karas, @kotlarmilos, @steveisok, @akoeplinger |
Contributor
|
Tagging subscribers to 'os-ios': @vitek-karas, @kotlarmilos, @steveisok, @akoeplinger |
This was referenced Sep 27, 2026
BrzVlad
approved these changes
Sep 28, 2026
This branch was successfully deployed
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.
Fixes Issue #134261
main PR #134699
Backport of #134699 to release/11.0.
Description
When compiled code (R2R or JIT) invokes an open virtual delegate, it calls the delegate shuffle thunk. On platforms without dynamic code (browser-wasm, iOS, tvOS, maccatalyst), that thunk is an IL stub run by the interpreter. It does
calli _methodPtrAux, and for an open virtual delegate that target isCID_VirtualOpenDelegateDispatch. That stub expects the address of_methodPtrAuxin a hidden argument thatcallicannot express (#134733):CID_VirtualOpenDelegateDispatchWorker.PrepareInterpreterCode.The fix makes the interpreter's
INTOP_CALLIrecognizeCID_VirtualOpenDelegateDispatchand resolve the target from the delegate and thethisargument, asINTOP_CALLDELEGATEalready does. The resolution is shared through a helper,ResolveOpenVirtualDelegateTarget.Differences from the main PR (cherry-pick conflicts):
src/libraries/tests.proj: not changed. release/11.0 doesn't have the browser ReadyToRun library-test lane, or the System.Linq.Expressions exclusion that main removed.src/coreclr/vm/interpexec.cpp:ResolveOpenVirtualDelegateTargetusesGCX_PREEMP();, matching the existingINTOP_CALLDELEGATEcode on this branch, since release/11.0 doesn't haveGCX_PREEMP_REGION_BEGIN/END.Customer Impact
On CoreCLR for iOS, tvOS and maccatalyst, and on browser-wasm with ReadyToRun, invoking an open virtual delegate from compiled code crashes the process. Examples are
MethodInfo.CreateDelegate<Func<object, string>>()bound toobject.ToStringor to an interface method, and LINQ Expressions compiled with the interpreter. On Apple platforms a second fault during crash logging turns the crash into a hang (#134720). There is no workaround in app code other than avoiding open virtual delegates.Regression
No. This is a bug in configurations newly supported in .NET 11 (CoreCLR on Apple mobile and browser-wasm), not a regression from a shipped release.
Testing
System.Runtime.TestsDelegateTestsinvoke open virtual delegates: class override, boxed struct, enum and interface dispatch. They crash without the fix on maccatalyst and on browser-wasm ReadyToRun. On main, System.Linq.Expressions.Tests also passes on the browser-wasm ReadyToRun lane with the fix.System.Runtime.Tests: 78,465 run, 0 failed, including both new tests.DelegateTests: 58 run, 0 failed.Risk
Low.
INTOP_CALLIbranch is only taken when thecallitarget is exactlyCID_VirtualOpenDelegateDispatch. That only happens for open virtual delegates invoked through the IL shuffle thunk, which crashed before.INTOP_CALLDELEGATEalready runs.FEATURE_CACHED_INTERFACE_DISPATCH.Note
This PR description was generated with GitHub Copilot.