From 4ed1a0cb90d85afb4a5c60be4e9f412048c5e187 Mon Sep 17 00:00:00 2001 From: Gaurav Khanna Date: Mon, 1 Aug 2016 12:03:26 -0700 Subject: Fix LoadFromAssemblyName to invoke fallback context (analogous to static assembly loads within the context) --- src/vm/assemblyspec.hpp | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) (limited to 'src/vm/assemblyspec.hpp') diff --git a/src/vm/assemblyspec.hpp b/src/vm/assemblyspec.hpp index 84e67dfcc2..a7e9c0f203 100644 --- a/src/vm/assemblyspec.hpp +++ b/src/vm/assemblyspec.hpp @@ -45,6 +45,9 @@ class AssemblySpec : public BaseAssemblySpec #if defined(FEATURE_HOST_ASSEMBLY_RESOLVER) // Contains the reference to the fallback load context associated with RefEmitted assembly requesting the load of another assembly (static or dynamic) ICLRPrivBinder *m_pFallbackLoadContextBinder; + + // Flag to indicate if we should prefer the fallback load context binder for binding or not. + bool m_fPreferFallbackLoadContextBinder; #endif // defined(FEATURE_HOST_ASSEMBLY_RESOLVER) BOOL IsValidAssemblyName(); @@ -74,7 +77,8 @@ class AssemblySpec : public BaseAssemblySpec m_pParentAssembly = NULL; #if defined(FEATURE_HOST_ASSEMBLY_RESOLVER) - m_pFallbackLoadContextBinder = NULL; + m_pFallbackLoadContextBinder = NULL; + m_fPreferFallbackLoadContextBinder = false; #endif // defined(FEATURE_HOST_ASSEMBLY_RESOLVER) } @@ -86,7 +90,8 @@ class AssemblySpec : public BaseAssemblySpec m_pParentAssembly = NULL; #if defined(FEATURE_HOST_ASSEMBLY_RESOLVER) - m_pFallbackLoadContextBinder = NULL; + m_pFallbackLoadContextBinder = NULL; + m_fPreferFallbackLoadContextBinder = false; #endif // defined(FEATURE_HOST_ASSEMBLY_RESOLVER) } @@ -187,6 +192,20 @@ class AssemblySpec : public BaseAssemblySpec return m_pFallbackLoadContextBinder; } + + void SetPreferFallbackLoadContextBinder() + { + LIMITED_METHOD_CONTRACT; + + m_fPreferFallbackLoadContextBinder = true; + } + + bool GetPreferFallbackLoadContextBinder() + { + LIMITED_METHOD_CONTRACT; + + return m_fPreferFallbackLoadContextBinder; + } #endif // defined(FEATURE_HOST_ASSEMBLY_RESOLVER) // Note that this method does not clone the fields! @@ -208,6 +227,7 @@ class AssemblySpec : public BaseAssemblySpec #if defined(FEATURE_HOST_ASSEMBLY_RESOLVER) // Copy the details of the fallback load context binder SetFallbackLoadContextBinderForRequestingAssembly(pSource->GetFallbackLoadContextBinderForRequestingAssembly()); + m_fPreferFallbackLoadContextBinder = pSource->GetPreferFallbackLoadContextBinder(); #endif // defined(FEATURE_HOST_ASSEMBLY_RESOLVER) m_HashForControl = pSource->m_HashForControl; -- cgit v1.2.3