From 83cec4da694fec5e489295c60794c781ad958744 Mon Sep 17 00:00:00 2001 From: David Mason Date: Sat, 17 Feb 2024 00:08:31 -0800 Subject: [PATCH] Check for EnC in profiler rejit (#98546) --- src/coreclr/pal/prebuilt/inc/corerror.h | 1 + src/coreclr/vm/rejit.cpp | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/src/coreclr/pal/prebuilt/inc/corerror.h b/src/coreclr/pal/prebuilt/inc/corerror.h index 994648cb25ea7b..12d3490aaf09d8 100644 --- a/src/coreclr/pal/prebuilt/inc/corerror.h +++ b/src/coreclr/pal/prebuilt/inc/corerror.h @@ -214,6 +214,7 @@ #define CORDIAGIPC_E_UNKNOWN_ERROR EMAKEHR(0x1387) #define CORPROF_E_SUSPENSION_IN_PROGRESS EMAKEHR(0x1388) #define CORPROF_E_NOT_GC_OBJECT EMAKEHR(0x1389) +#define CORPROF_E_MODULE_IS_ENC EMAKEHR(0x138A) #define CORSEC_E_POLICY_EXCEPTION EMAKEHR(0x1416) #define CORSEC_E_MIN_GRANT_FAIL EMAKEHR(0x1417) #define CORSEC_E_NO_EXEC_PERM EMAKEHR(0x1418) diff --git a/src/coreclr/vm/rejit.cpp b/src/coreclr/vm/rejit.cpp index c4f7394a93870a..071fddacb3f411 100644 --- a/src/coreclr/vm/rejit.cpp +++ b/src/coreclr/vm/rejit.cpp @@ -508,6 +508,12 @@ HRESULT ReJitManager::UpdateActiveILVersions( continue; } + if (pModule->IsEditAndContinueEnabled()) + { + ReportReJITError(pModule, rgMethodDefs[i], NULL, CORPROF_E_MODULE_IS_ENC); + continue; + } + if (!pModule->GetMDImport()->IsValidToken(rgMethodDefs[i])) { ReportReJITError(pModule, rgMethodDefs[i], NULL, E_INVALIDARG);