Very small cleanup of various comments and code formatting (#19665)
authorVitek Karas <vitek.karas@microsoft.com>
Sat, 25 Aug 2018 05:37:44 +0000 (22:37 -0700)
committerJan Kotas <jkotas@microsoft.com>
Sat, 25 Aug 2018 05:37:44 +0000 (22:37 -0700)
* Very small cleanpu of various comments and code formatting

Fixed couple of comments to match the code and the wording.
Fixed indentation in several places.
Removed unused local variable in AppDomain::BindAssemblySpec

* Remove unused enum in the binder

src/System.Private.CoreLib/src/System/Reflection/Assembly.CoreCLR.cs
src/System.Private.CoreLib/src/System/Runtime/Loader/AssemblyLoadContext.cs
src/binder/assemblybinder.cpp
src/binder/clrprivbinderassemblyloadcontext.cpp
src/binder/clrprivbindercoreclr.cpp
src/vm/appdomain.cpp

index 6de94d4e8ace06c654b7b97c4366b9af9a3ecebe..e18eef7e454d3c491dacbb6c884a014fe4e35dcd 100644 (file)
@@ -158,9 +158,8 @@ namespace System.Reflection
         }
 
         // Loads the assembly with a COFF based IMAGE containing
-        // an emitted assembly. The assembly is loaded into the domain
-        // of the caller. The second parameter is the raw bytes
-        // representing the symbol store that matches the assembly.
+        // an emitted assembly. The assembly is loaded into a fully isolated ALC with resolution fully deferred to the AssemblyLoadContext.Default.
+        // The second parameter is the raw bytes representing the symbol store that matches the assembly.
         [System.Security.DynamicSecurityMethod] // Methods containing StackCrawlMark local var has to be marked DynamicSecurityMethod
         public static Assembly Load(byte[] rawAssembly,
                                     byte[] rawSymbolStore)
@@ -203,9 +202,7 @@ namespace System.Reflection
             return result;
         }
 
-        /*
-         * Get the assembly that the current code is running from.
-         */
+        // Get the assembly that the current code is running from.
         [System.Security.DynamicSecurityMethod] // Methods containing StackCrawlMark local var has to be marked DynamicSecurityMethod 
         public static Assembly GetExecutingAssembly()
         {
@@ -216,9 +213,9 @@ namespace System.Reflection
         [System.Security.DynamicSecurityMethod] // Methods containing StackCrawlMark local var has to be marked DynamicSecurityMethod
         public static Assembly GetCallingAssembly()
         {
-            // LookForMyCallersCaller is not guarantee to return the correct stack frame
+            // LookForMyCallersCaller is not guaranteed to return the correct stack frame
             // because of inlining, tail calls, etc. As a result GetCallingAssembly is not 
-            // ganranteed to return the correct result. We should document it as such.
+            // guaranteed to return the correct result. It's also documented as such.
             StackCrawlMark stackMark = StackCrawlMark.LookForMyCallersCaller;
             return RuntimeAssembly.GetExecutingAssembly(ref stackMark);
         }
index 746d39742bb44ec264d191f33dd0b7ec534cb97b..5738786f520a1baf67806f60b38e1a99c088de64 100644 (file)
@@ -190,7 +190,6 @@ namespace System.Runtime.Loader
                 }
 
                 // Basic validation has succeeded - lets try to load the NI image.
-                // Ask LoadFile to load the specified assembly in the DefaultContext
                 RuntimeAssembly loadedAssembly = null;
                 LoadFromPath(m_pNativeAssemblyLoadContext, assemblyPath, nativeImagePath, JitHelpers.GetObjectHandleOnStack(ref loadedAssembly));
                 return loadedAssembly;
index 7c0aa8077e9d3f523bd8d94a00bb80faf7e687e5..85005be3a08f77d2c69b8224658e29f2e9eb0fc3 100644 (file)
@@ -61,18 +61,6 @@ extern BOOL RuntimeCanUseAppPathAssemblyResolver(DWORD adid);
 
 namespace BINDER_SPACE
 {
-    typedef enum
-    {
-        kVersionIgnore,
-        kVersionExact,
-        kVersionServiceRollForward,
-        kVersionFeatureRollForward,
-        kVersionFeatureExact,
-        kVersionFeatureHighest,
-        kVersionFeatureLowestHigher,
-        kVersionFeatureHighestLower
-    } VersionMatchMode;
-
     namespace
     {
         BOOL fAssemblyBinderInitialized = FALSE;
index e1ecdc843634bcc0a68d1888df129c27bc36c8f4..e981314b82ddc895384c3bd788ecab2ae3fcfa68 100644 (file)
@@ -45,7 +45,7 @@ HRESULT CLRPrivBinderAssemblyLoadContext::BindAssemblyByNameWorker(BINDER_SPACE:
 }
 
 HRESULT CLRPrivBinderAssemblyLoadContext::BindAssemblyByName(IAssemblyName     *pIAssemblyName,
-                                                 ICLRPrivAssembly **ppAssembly)
+                                                             ICLRPrivAssembly **ppAssembly)
 {
     HRESULT hr = S_OK;
     VALIDATE_ARG_RET(pIAssemblyName != nullptr && ppAssembly != nullptr);
index 051389cb6feb8fc85b012f7c8c5598ffaaf4d50e..9bad805a2e3ccc9cb94d459b05128f54629b4df5 100644 (file)
@@ -80,18 +80,18 @@ HRESULT CLRPrivBinderCoreCLR::BindAssemblyByName(IAssemblyName     *pIAssemblyNa
             INT_PTR pManagedAssemblyLoadContext = GetManagedAssemblyLoadContext();
             if (pManagedAssemblyLoadContext != NULL)
             {
-              hr = AssemblyBinder::BindUsingHostAssemblyResolver(pManagedAssemblyLoadContext, pAssemblyName, pIAssemblyName, 
-              NULL, &pCoreCLRFoundAssembly);
-              if (SUCCEEDED(hr))
-              {
-                  // We maybe returned an assembly that was bound to a different AssemblyLoadContext instance.
-                  // In such a case, we will not overwrite the binding context (which would be wrong since it would not
-                  // be present in the cache of the current binding context).
-                  if (pCoreCLRFoundAssembly->GetBinder() == NULL)
-                  {
-                      pCoreCLRFoundAssembly->SetBinder(this);
-                  }
-              }
+                hr = AssemblyBinder::BindUsingHostAssemblyResolver(pManagedAssemblyLoadContext, pAssemblyName, pIAssemblyName, 
+                                                                   NULL, &pCoreCLRFoundAssembly);
+                if (SUCCEEDED(hr))
+                {
+                    // We maybe returned an assembly that was bound to a different AssemblyLoadContext instance.
+                    // In such a case, we will not overwrite the binding context (which would be wrong since it would not
+                    // be present in the cache of the current binding context).
+                    if (pCoreCLRFoundAssembly->GetBinder() == NULL)
+                    {
+                        pCoreCLRFoundAssembly->SetBinder(this);
+                    }
+                }
             }
         }
 #endif // !defined(DACCESS_COMPILE) && !defined(CROSSGEN_COMPILE)
@@ -109,8 +109,8 @@ Exit:;
 
 #if !defined(DACCESS_COMPILE) && !defined(CROSSGEN_COMPILE)
 HRESULT CLRPrivBinderCoreCLR::BindUsingPEImage( /* in */ PEImage *pPEImage, 
-                                                            /* in */ BOOL fIsNativeImage, 
-                                                            /* [retval][out] */ ICLRPrivAssembly **ppAssembly)
+                                                /* in */ BOOL fIsNativeImage, 
+                                                /* [retval][out] */ ICLRPrivAssembly **ppAssembly)
 {
     HRESULT hr = S_OK;
 
index f1c7d0a81fa0c0794e8556058df52695e69792a2..388aded4788734be1f596f790b321f4160fb8ad3 100644 (file)
@@ -7025,8 +7025,6 @@ EndTry2:;
                 {
                     bool fAddFileToCache = false;
 
-                    BOOL fIsWellKnown = FALSE;
-
                     // Use CoreClr's fusion alternative
                     CoreBindResult bindResult;
 
@@ -7068,7 +7066,7 @@ EndTry2:;
                             AddFileToCache(pSpec, result, TRUE /*fAllowFailure*/);
                         }
                     }
-                    else if (!fIsWellKnown)
+                    else
                     {
                         _ASSERTE(fThrowOnFileNotFound == FALSE);