From: Steve MacLean Date: Mon, 4 Feb 2019 18:36:52 +0000 (-0500) Subject: Handle SPC in GetLoadContext X-Git-Tag: accepted/tizen/unified/20190813.215958~132 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7e20b6fa7b2253511b6f0a7d76c955360e040df6;p=platform%2Fupstream%2Fcoreclr.git Handle SPC in GetLoadContext GetBindingContext() returns NULL for System.Private.CoreLib. Add support for this special case. --- diff --git a/src/vm/assemblynative.cpp b/src/vm/assemblynative.cpp index 4167263..6a8efff 100644 --- a/src/vm/assemblynative.cpp +++ b/src/vm/assemblynative.cpp @@ -1302,13 +1302,22 @@ INT_PTR QCALLTYPE AssemblyNative::GetLoadContextForAssembly(QCall::AssemblyHandl // actual ICLRPrivBinder instance in which the assembly was loaded. PTR_ICLRPrivBinder pBindingContext = pPEAssembly->GetBindingContext(); UINT_PTR assemblyBinderID = 0; - IfFailThrow(pBindingContext->GetBinderID(&assemblyBinderID)); - // If the assembly was bound using the TPA binder, - // then we will return the reference to "Default" binder from the managed implementation when this QCall returns. - // - // See earlier comment about "Default" binder for additional context. - pOpaqueBinder = reinterpret_cast(assemblyBinderID); + if (pBindingContext) + { + IfFailThrow(pBindingContext->GetBinderID(&assemblyBinderID)); + + // If the assembly was bound using the TPA binder, + // then we will return the reference to "Default" binder from the managed implementation when this QCall returns. + // + // See earlier comment about "Default" binder for additional context. + pOpaqueBinder = reinterpret_cast(assemblyBinderID); + } + else + { + // GetBindingContext() returns NULL for System.Private.CoreLib + pOpaqueBinder = pTPABinder; + } // We should have a load context binder at this point. _ASSERTE(pOpaqueBinder != nullptr);