From 8430481986f663c593e5c2e3cb7f8b6a935f01b4 Mon Sep 17 00:00:00 2001 From: Jan Vorlicek Date: Mon, 22 Jun 2020 17:16:46 +0200 Subject: [PATCH] Remove assert in PEFile::GetAssemblyLoadContext The method can return NULL for System.Private.CoreLib during early runtime initialization stage when the underlying AssemblyLoadContext doesn't exist yet. --- src/coreclr/src/vm/pefile.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/coreclr/src/vm/pefile.h b/src/coreclr/src/vm/pefile.h index 518449d168919..2217a0c224a33 100644 --- a/src/coreclr/src/vm/pefile.h +++ b/src/coreclr/src/vm/pefile.h @@ -581,11 +581,13 @@ class PEFile #endif //!DACCESS_COMPILE + // Returns AssemblyLoadContext into which the current PEFile was loaded. + // It returns NULL for System.Private.CoreLib during early runtime initialization + // stage when the related AssemblyLoadContext does not exist yet. PTR_AssemblyLoadContext GetAssemblyLoadContext() { LIMITED_METHOD_CONTRACT; - _ASSERTE(m_pAssemblyLoadContext != NULL); return m_pAssemblyLoadContext; }