return TPA assembly if loadfrom is passed a path to assembly with same identity
authorRahul Kumar <rahku@microsoft.com>
Tue, 28 Mar 2017 20:25:27 +0000 (13:25 -0700)
committerRahul Kumar <rahku@microsoft.com>
Tue, 28 Mar 2017 20:25:27 +0000 (13:25 -0700)
src/binder/clrprivbindercoreclr.cpp
src/vm/assemblynative.cpp

index b7a6807..d756454 100644 (file)
@@ -159,8 +159,8 @@ HRESULT CLRPrivBinderCoreCLR::BindUsingPEImage( /* in */ PEImage *pPEImage,
                 {
                     if (pCoreCLRFoundAssembly->GetIsInGAC())
                     {
-                        // If we were able to bind to a TPA assembly, then fail the load
-                        IF_FAIL_GO(HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND));
+                        *ppAssembly = pCoreCLRFoundAssembly.Extract();
+                        goto Exit;                        
                     }
                 }
             }
index ed5cd72..b9079ec 100644 (file)
@@ -507,9 +507,12 @@ Assembly* AssemblyNative::LoadFromPEImage(ICLRPrivBinder* pBinderContext, PEImag
         spec.GetFileOrDisplayName(0, name);
         COMPlusThrowHR(COR_E_FILELOAD, dwMessageID, name);
     }
+
+    BINDER_SPACE::Assembly* assem;
+    assem = BINDER_SPACE::GetAssemblyFromPrivAssemblyFast(pAssembly);
     
-    PEAssemblyHolder pPEAssembly(PEAssembly::Open(pParentAssembly, pILImage, pNIImage, pAssembly, FALSE));
-    
+    PEAssemblyHolder pPEAssembly(PEAssembly::Open(pParentAssembly, assem->GetPEImage(), assem->GetNativePEImage(), pAssembly, FALSE));
+
     GCX_COOP();
     
     IApplicationSecurityDescriptor *pDomainSecDesc = pCurDomain->GetSecurityDescriptor();