From 4a221c6f0f882eee0a77e570232dcb65c1ae08fd Mon Sep 17 00:00:00 2001 From: Jackson Schuster <36744439+jtschuster@users.noreply.github.com> Date: Thu, 16 Apr 2026 17:03:04 -0700 Subject: [PATCH 1/2] Don't try to find an R2R entrypoint for return-dropping thunks --- src/coreclr/vm/readytoruninfo.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/coreclr/vm/readytoruninfo.cpp b/src/coreclr/vm/readytoruninfo.cpp index a6eb8e6e742e16..5586a9db94202a 100644 --- a/src/coreclr/vm/readytoruninfo.cpp +++ b/src/coreclr/vm/readytoruninfo.cpp @@ -1281,6 +1281,14 @@ PCODE ReadyToRunInfo::GetEntryPoint(MethodDesc * pMD, PrepareCodeConfig* pConfig if (ReadyToRunCodeDisabled()) goto done; + // Return-dropping async thunks are VM-synthesized. They share the same metadata + // token and signature shape as a regular async variant, so the R2R lookup below + // would incorrectly bind the thunk to the non-thunk's compiled code and bypass + // the virtual dispatch the thunk performs. Crossgen2 does not emit R2R code for + // these thunks; fall back to transient IL generation in the prestub. + if (pMD->IsReturnDroppingThunk()) + goto done; + ETW::MethodLog::GetR2RGetEntryPointStart(pMD); uint offset; From d15abc084a4fb8d722063ec1ebd33c3067812626 Mon Sep 17 00:00:00 2001 From: Jackson Schuster <36744439+jtschuster@users.noreply.github.com> Date: Mon, 20 Apr 2026 14:58:38 -0700 Subject: [PATCH 2/2] Re-enable covariant-return crossgen test The R2R entrypoint lookup fix in readytoruninfo.cpp resolves https://github.com/dotnet/runtime/issues/126755, so the CrossGenTest=false workaround added in #126775 can be removed. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- src/tests/async/covariant-return/covariant-returns.csproj | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/tests/async/covariant-return/covariant-returns.csproj b/src/tests/async/covariant-return/covariant-returns.csproj index eaf76ccb482db5..69b3bbaf0d7fb0 100644 --- a/src/tests/async/covariant-return/covariant-returns.csproj +++ b/src/tests/async/covariant-return/covariant-returns.csproj @@ -2,8 +2,6 @@ true - - false