diff options
author | Gaurav Khanna <gkhanna@microsoft.com> | 2017-04-27 15:36:24 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-04-27 15:36:24 -0700 |
commit | d2c5fed03744206122b074a766adaa82634d17ba (patch) | |
tree | 5dee894766aef7fedcb37c127c4261411065df73 /src/vm/pefile.cpp | |
parent | b9dcd7a02db0881c63686f52700902e5ca5ced14 (diff) | |
download | coreclr-d2c5fed03744206122b074a766adaa82634d17ba.tar.gz coreclr-d2c5fed03744206122b074a766adaa82634d17ba.tar.bz2 coreclr-d2c5fed03744206122b074a766adaa82634d17ba.zip |
Unify fetching LoadContext for Dynamic Assemblies (#11264)
Diffstat (limited to 'src/vm/pefile.cpp')
-rw-r--r-- | src/vm/pefile.cpp | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/vm/pefile.cpp b/src/vm/pefile.cpp index 16c66b516d..c7870e6366 100644 --- a/src/vm/pefile.cpp +++ b/src/vm/pefile.cpp @@ -2849,12 +2849,22 @@ PTR_ICLRPrivBinder PEFile::GetBindingContext() PTR_ICLRPrivBinder pBindingContext = NULL; - // Mscorlib is always bound in context of the TPA Binder. However, since it gets loaded and published - // during EEStartup *before* TPAbinder is initialized, we dont have a binding context to publish against. + // CoreLibrary is always bound in context of the TPA Binder. However, since it gets loaded and published + // during EEStartup *before* DefaultContext Binder (aka TPAbinder) is initialized, we dont have a binding context to publish against. // Thus, we will always return NULL for its binding context. if (!IsSystem()) { pBindingContext = dac_cast<PTR_ICLRPrivBinder>(GetHostAssembly()); + if (!pBindingContext) + { + // If we do not have any binding context, check if we are dealing with + // a dynamically emitted assembly and if so, use its fallback load context + // binder reference. + if (IsDynamic()) + { + pBindingContext = GetFallbackLoadContextBinder(); + } + } } return pBindingContext; |