From 2e9645589745121a58f6f0cb819b02de8b7ac373 Mon Sep 17 00:00:00 2001 From: Rahul Kumar Date: Wed, 22 Feb 2017 16:54:48 -0800 Subject: [PATCH] Ignore binder context for corelib when performing binding cache lookup Commit migrated from https://github.com/dotnet/coreclr/commit/3ac0d28ef7b707c026f7ca2a709b248899b186d9 --- src/coreclr/src/vm/assemblyspec.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/coreclr/src/vm/assemblyspec.cpp b/src/coreclr/src/vm/assemblyspec.cpp index b969e8d..e278c00 100644 --- a/src/coreclr/src/vm/assemblyspec.cpp +++ b/src/coreclr/src/vm/assemblyspec.cpp @@ -1276,7 +1276,14 @@ AssemblySpecBindingCache::AssemblyBinding* AssemblySpecBindingCache::GetAssembly // Check if the AssemblySpec already has specified its binding context. This will be set for assemblies that are // attempted to be explicitly bound using AssemblyLoadContext LoadFrom* methods. - pBinderContextForLookup = pSpec->GetBindingContext(); + if(!pSpec->IsAssemblySpecForMscorlib()) + pBinderContextForLookup = pSpec->GetBindingContext(); + else + { + // For System.Private.Corelib Binding context is either not set or if set then it should be TPA + _ASSERTE(pSpec->GetBindingContext() == NULL || pSpec->GetBindingContext() == pSpecDomain->GetFusionContext()); + } + if (pBinderContextForLookup != NULL) { // We are working with the actual binding context in which the assembly was expected to be loaded. -- 2.7.4