}
// 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)
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()
{
[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);
}
}
// 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;
namespace BINDER_SPACE
{
- typedef enum
- {
- kVersionIgnore,
- kVersionExact,
- kVersionServiceRollForward,
- kVersionFeatureRollForward,
- kVersionFeatureExact,
- kVersionFeatureHighest,
- kVersionFeatureLowestHigher,
- kVersionFeatureHighestLower
- } VersionMatchMode;
-
namespace
{
BOOL fAssemblyBinderInitialized = FALSE;
}
HRESULT CLRPrivBinderAssemblyLoadContext::BindAssemblyByName(IAssemblyName *pIAssemblyName,
- ICLRPrivAssembly **ppAssembly)
+ ICLRPrivAssembly **ppAssembly)
{
HRESULT hr = S_OK;
VALIDATE_ARG_RET(pIAssemblyName != nullptr && ppAssembly != nullptr);
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)
#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;
{
bool fAddFileToCache = false;
- BOOL fIsWellKnown = FALSE;
-
// Use CoreClr's fusion alternative
CoreBindResult bindResult;
AddFileToCache(pSpec, result, TRUE /*fAllowFailure*/);
}
}
- else if (!fIsWellKnown)
+ else
{
_ASSERTE(fThrowOnFileNotFound == FALSE);