From 5144947b45832e170b2eb3b8f909ec49d7122eaa Mon Sep 17 00:00:00 2001 From: Jeremy Koritzinsky Date: Wed, 3 Apr 2019 04:21:16 -0700 Subject: Treat WinMDs as having been loaded in the default ALC for AssemblyLoadContext.GetLoadContext (#23678) --- src/vm/assemblynative.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/vm/assemblynative.cpp b/src/vm/assemblynative.cpp index 6cbb8afc17..a7d6863b57 100644 --- a/src/vm/assemblynative.cpp +++ b/src/vm/assemblynative.cpp @@ -1331,7 +1331,14 @@ INT_PTR QCALLTYPE AssemblyNative::GetLoadContextForAssembly(QCall::AssemblyHandl // We should have a load context binder at this point. _ASSERTE(pOpaqueBinder != nullptr); + // the TPA binder uses the default ALC + // WinRT assemblies (bound using the WinRT binder) don't actually have an ALC, + // so treat them the same as if they were loaded into the TPA ALC in this case. +#ifdef FEATURE_COMINTEROP + if (!AreSameBinderInstance(pTPABinder, pOpaqueBinder) && !AreSameBinderInstance(pCurDomain->GetWinRtBinder(), pOpaqueBinder)) +#else if (!AreSameBinderInstance(pTPABinder, pOpaqueBinder)) +#endif // FEATURE_COMINTEROP { // Only CLRPrivBinderAssemblyLoadContext instance contains the reference to its // corresponding managed instance. -- cgit v1.2.3