Very small cleanup of various comments and code formatting (dotnet/coreclr#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

Commit migrated from https://github.com/dotnet/coreclr/commit/3fca50a36e62a7433d7601d805d38de6baee7951

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

index 6de94d4..e18eef7 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 746d397..5738786 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 7c0aa80..85005be 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 e1ecdc8..e981314 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 051389c..9bad805 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 f1c7d0a..388aded 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);