Fix setting winrt assembly's fallback binder (dotnet/coreclr#27348)
authorElinor Fung <47805090+elinor-fung@users.noreply.github.com>
Tue, 22 Oct 2019 00:56:41 +0000 (17:56 -0700)
committerJan Kotas <jkotas@microsoft.com>
Tue, 22 Oct 2019 00:56:41 +0000 (17:56 -0700)
Remove unused AssemblySpec::SetHostBinder

Commit migrated from https://github.com/dotnet/coreclr/commit/69721cc27a115363e7c0f8b92210572bb67f8b93

src/coreclr/src/vm/appdomain.cpp
src/coreclr/src/vm/appdomain.hpp
src/coreclr/src/vm/assemblyspec.cpp
src/coreclr/src/vm/assemblyspec.hpp
src/coreclr/src/vm/baseassemblyspec.h
src/coreclr/src/vm/baseassemblyspec.inl
src/coreclr/src/vm/compile.cpp
src/coreclr/src/vm/compile.h

index a47e5a0..ba59930 100644 (file)
@@ -5029,8 +5029,7 @@ AppDomain::BindHostedPrivAssembly(
 //---------------------------------------------------------------------------------------------------------------------
 PEAssembly * AppDomain::BindAssemblySpec(
     AssemblySpec *         pSpec, 
-    BOOL                   fThrowOnFileNotFound, 
-    BOOL                   fUseHostBinderIfAvailable)
+    BOOL                   fThrowOnFileNotFound)
 {
     STATIC_CONTRACT_THROWS;
     STATIC_CONTRACT_GC_TRIGGERS;
@@ -5065,7 +5064,7 @@ PEAssembly * AppDomain::BindAssemblySpec(
                 goto EndTry2; // Goto end of try block.
 
             PTR_CLRPrivAssemblyWinRT assem = dac_cast<PTR_CLRPrivAssemblyWinRT>(pAssembly->GetHostAssembly());
-            assem->SetFallbackBinder(pSpec->GetHostBinder());
+            assem->SetFallbackBinder(pSpec->GetFallbackLoadContextBinderForRequestingAssembly());
 EndTry2:;
         }
         // The combination of this conditional catch/ the following if statement which will throw reduces the count of exceptions 
index 1e5ee8d..1ead566 100644 (file)
@@ -2097,8 +2097,7 @@ public:
     // static binding goes through this path.
     virtual PEAssembly * BindAssemblySpec(
         AssemblySpec *pSpec,
-        BOOL fThrowOnFileNotFound,
-        BOOL fUseHostBinderIfAvailable = TRUE) DAC_EMPTY_RET(NULL);
+        BOOL fThrowOnFileNotFound) DAC_EMPTY_RET(NULL);
 
     HRESULT BindAssemblySpecForHostedBinder(
         AssemblySpec *   pSpec, 
index 1d14d55..795261d 100644 (file)
@@ -908,14 +908,6 @@ DomainAssembly *AssemblySpec::LoadDomainAssembly(FileLoadLevel targetLevel,
 
     ETWOnStartup (LoaderCatchCall_V1, LoaderCatchCallEnd_V1);
     AppDomain* pDomain = GetAppDomain();
-    
-    ICLRPrivBinder* pBinder = GetHostBinder();
-    
-    // If no binder was explicitly set, check if parent assembly has a binder.
-    if (pBinder == nullptr)
-    {
-        pBinder = GetBindingContextFromParentAssembly(pDomain);
-    }
 
     DomainAssembly* pAssembly = nullptr;
     if (CanUseWithBindingCache())
@@ -1494,8 +1486,6 @@ BOOL AssemblySpecBindingCache::StoreAssembly(AssemblySpec *pSpec, DomainAssembly
         THROWS;
         GC_TRIGGERS;
         MODE_ANY;
-        // Host binder based assembly spec's cannot currently be safely inserted into caches.
-        PRECONDITION(pSpec->GetHostBinder() == nullptr);
         POSTCONDITION(UnsafeContains(this, pSpec));
         POSTCONDITION(UnsafeVerifyLookupAssembly(this, pSpec, pAssembly));
         INJECT_FAULT(COMPlusThrowOM(););
@@ -1582,8 +1572,6 @@ BOOL AssemblySpecBindingCache::StoreFile(AssemblySpec *pSpec, PEAssembly *pFile)
         THROWS;
         GC_TRIGGERS;
         MODE_ANY;
-        // Host binder based assembly spec's cannot currently be safely inserted into caches.
-        PRECONDITION(pSpec->GetHostBinder() == nullptr);
         POSTCONDITION((!RETVAL) || (UnsafeContains(this, pSpec) && UnsafeVerifyLookupFile(this, pSpec, pFile)));
         INJECT_FAULT(COMPlusThrowOM(););
     }
@@ -1672,8 +1660,6 @@ BOOL AssemblySpecBindingCache::StoreException(AssemblySpec *pSpec, Exception* pE
         THROWS;
         GC_TRIGGERS;
         MODE_ANY;
-        // Host binder based assembly spec's cannot currently be safely inserted into caches.
-        PRECONDITION(pSpec->GetHostBinder() == nullptr);
         DISABLED(POSTCONDITION(UnsafeContains(this, pSpec))); //<TODO>@todo: Getting violations here - StoreExceptions could happen anywhere so this is possibly too aggressive.</TODO>
         INJECT_FAULT(COMPlusThrowOM(););
     }
index 2d2493c..822c376 100644 (file)
@@ -281,19 +281,6 @@ class AssemblySpec  : public BaseAssemblySpec
         STATIC_CONTRACT_LIMITED_METHOD;
         return HasUniqueIdentity(); 
     }
-
-    inline ICLRPrivBinder *GetHostBinder() const
-    {
-        LIMITED_METHOD_CONTRACT;
-        return m_pHostBinder;
-    }
-
-    inline void SetHostBinder(ICLRPrivBinder *pHostBinder)
-    {
-        LIMITED_METHOD_CONTRACT;
-        m_pHostBinder = pHostBinder;
-    }
-
 };
 
 #define INITIAL_ASM_SPEC_HASH_SIZE 7
index ba24460..6817245 100644 (file)
@@ -29,7 +29,6 @@ protected:
     LPCWSTR                     m_wszCodeBase;         // URL to the code
     LPCSTR                      m_szWinRtTypeNamespace;
     LPCSTR                      m_szWinRtTypeClassName;
-    ICLRPrivBinder             *m_pHostBinder;
     int                         m_ownedFlags;
     ICLRPrivBinder             *m_pBindingContext;
 
index 468d604..9a4f70e 100644 (file)
@@ -256,8 +256,6 @@ inline void BaseAssemblySpec::CopyFrom(const BaseAssemblySpec *pSpec)
     
     m_context = pSpec->m_context;
 
-    m_pHostBinder = pSpec->m_pHostBinder;
-
     if ((pSpec->m_ownedFlags & BAD_NAME_OWNED) != 0)
     {
         m_ownedFlags |= BAD_NAME_OWNED;
index 0cad973..9fa26b9 100644 (file)
@@ -317,7 +317,7 @@ HRESULT CEECompileInfo::LoadAssemblyByPath(
             // If there is a host binder then use it to bind the assembly.
             if (isWinRT)
             {
-                pAssemblyHolder = pDomain->BindAssemblySpec(&spec, TRUE, FALSE);
+                pAssemblyHolder = pDomain->BindAssemblySpec(&spec, TRUE);
             }
             else
             {
@@ -531,7 +531,7 @@ HRESULT CEECompileInfo::SetCompilationTarget(CORINFO_ASSEMBLY_HANDLE     assembl
 
         AssemblySpec mscorlib;
         mscorlib.InitializeSpec(SystemDomain::SystemFile());
-        GetAppDomain()->BindAssemblySpec(&mscorlib,TRUE,FALSE);
+        GetAppDomain()->BindAssemblySpec(&mscorlib,TRUE);
 
         if (!IsReadyToRunCompilation() && !SystemDomain::SystemFile()->HasNativeImage())
         {
@@ -7178,8 +7178,7 @@ void ReportMissingDependency(Exception * e)
 
 PEAssembly *CompilationDomain::BindAssemblySpec(
     AssemblySpec *pSpec,
-    BOOL fThrowOnFileNotFound,
-    BOOL fUseHostBinderIfAvailable)
+    BOOL fThrowOnFileNotFound)
 {
     PEAssembly *pFile = NULL;
     //
@@ -7194,8 +7193,7 @@ PEAssembly *CompilationDomain::BindAssemblySpec(
         //
         pFile = AppDomain::BindAssemblySpec(
             pSpec,
-            fThrowOnFileNotFound,
-            fUseHostBinderIfAvailable);
+            fThrowOnFileNotFound);
     }
     EX_HOOK
     {
index 5a4468c..decdc84 100644 (file)
@@ -789,8 +789,7 @@ class CompilationDomain : public AppDomain,
 
     PEAssembly *BindAssemblySpec(
         AssemblySpec *pSpec,
-        BOOL fThrowOnFileNotFound,
-        BOOL fUseHostBinderIfAvailable = TRUE) DAC_EMPTY_RET(NULL);
+        BOOL fThrowOnFileNotFound) DAC_EMPTY_RET(NULL);
 
     BOOL CanEagerBindToZapFile(Module *targetModule, BOOL limitToHardBindList = TRUE);