diff --git a/src/System.Private.CoreLib/src/System/Reflection/RuntimeAssembly.cs b/src/System.Private.CoreLib/src/System/Reflection/RuntimeAssembly.cs index 16dc8ec474be..a97fddc782b5 100644 --- a/src/System.Private.CoreLib/src/System/Reflection/RuntimeAssembly.cs +++ b/src/System.Private.CoreLib/src/System/Reflection/RuntimeAssembly.cs @@ -25,7 +25,9 @@ internal class RuntimeAssembly : Assembly private event ModuleResolveEventHandler _ModuleResolve; private string? m_fullname; private object? m_syncRoot; // Used to keep collectible types alive and as the syncroot for reflection.emit +#pragma warning disable 169 private IntPtr m_assembly; // slack for ptr datum on unmanaged side +#pragma warning restore 169 #endregion diff --git a/src/binder/assemblyname.cpp b/src/binder/assemblyname.cpp index 616869b3f903..bc978140b143 100644 --- a/src/binder/assemblyname.cpp +++ b/src/binder/assemblyname.cpp @@ -486,6 +486,15 @@ namespace BINDER_SPACE { dwUseIdentityFlags &= ~AssemblyIdentity::IDENTITY_FLAG_CONTENT_TYPE; } + if ((dwIncludeFlags & INCLUDE_PUBLIC_KEY_TOKEN) == 0) + { + dwUseIdentityFlags &= ~AssemblyIdentity::IDENTITY_FLAG_PUBLIC_KEY; + dwUseIdentityFlags &= ~AssemblyIdentity::IDENTITY_FLAG_PUBLIC_KEY_TOKEN; + } + if ((dwIncludeFlags & EXCLUDE_CULTURE) != 0) + { + dwUseIdentityFlags &= ~AssemblyIdentity::IDENTITY_FLAG_CULTURE; + } dwHash ^= static_cast(HashCaseInsensitive(GetSimpleName())); dwHash = _rotl(dwHash, 4); diff --git a/src/vm/assemblynative.cpp b/src/vm/assemblynative.cpp index aa830932ed5c..cc9515140885 100644 --- a/src/vm/assemblynative.cpp +++ b/src/vm/assemblynative.cpp @@ -78,18 +78,18 @@ FCIMPL6(Object*, AssemblyNative::Load, AssemblyNameBaseObject* assemblyNameUNSAF else { // Compute parent assembly - if (gc.requestingAssembly == NULL) + if (gc.requestingAssembly != NULL) { - pRefAssembly = SystemDomain::GetCallersAssembly(stackMark); + pRefAssembly = gc.requestingAssembly->GetAssembly(); } - else + else if (ptrLoadContextBinder == NULL) { - pRefAssembly = gc.requestingAssembly->GetAssembly(); + pRefAssembly = SystemDomain::GetCallersAssembly(stackMark); } if (pRefAssembly) { - pParentAssembly= pRefAssembly->GetDomainAssembly(); + pParentAssembly = pRefAssembly->GetDomainAssembly(); } } diff --git a/tests/CoreFX/CoreFX.issues.json b/tests/CoreFX/CoreFX.issues.json index b0eb61c7d44d..e8428f5a928b 100644 --- a/tests/CoreFX/CoreFX.issues.json +++ b/tests/CoreFX/CoreFX.issues.json @@ -1149,6 +1149,20 @@ ] } }, + { + "name": "System.Runtime.Loader.DefaultContext.Tests", + "enabled": true, + "exclusions": { + "namespaces": null, + "classes": null, + "methods": [ + { + "name" : "System.Runtime.Loader.Tests.DefaultLoadContextTests.LoadInDefaultContext", + "reason" : "Waiting for https://github.com/dotnet/corefx/pull/37071" + } + ] + } + }, { "name": "System.Runtime.Loader.Tests", "enabled": true, diff --git a/tests/src/Loader/ContextualReflection/ContextualReflection.cs b/tests/src/Loader/ContextualReflection/ContextualReflection.cs index 1612c141b2d4..2c1d081db6f3 100644 --- a/tests/src/Loader/ContextualReflection/ContextualReflection.cs +++ b/tests/src/Loader/ContextualReflection/ContextualReflection.cs @@ -321,6 +321,9 @@ void TestAssemblyLoad(bool isolated) { TestAssemblyLoad(isolated, (string assemblyName) => Assembly.Load(assemblyName)); TestAssemblyLoad(isolated, (string assemblyName) => Assembly.Load(new AssemblyName(assemblyName))); +#pragma warning disable 618 + TestAssemblyLoad(isolated, (string assemblyName) => Assembly.LoadWithPartialName(assemblyName)); +#pragma warning restore 618 } void TestAssemblyLoad(bool isolated, Func assemblyLoad) @@ -748,7 +751,6 @@ public void RunTests(bool isolated) TestMockAssemblyThrows(); } - [MethodImplAttribute(MethodImplOptions.NoInlining)] public void RunTestsIsolated() { VerifyIsolationAlc(); diff --git a/tests/src/Loader/ContextualReflection/ContextualReflectionDependency.cs b/tests/src/Loader/ContextualReflection/ContextualReflectionDependency.cs index f498db49a758..933194a304ef 100644 --- a/tests/src/Loader/ContextualReflection/ContextualReflectionDependency.cs +++ b/tests/src/Loader/ContextualReflection/ContextualReflectionDependency.cs @@ -16,7 +16,6 @@ public interface IProgram Assembly alcAssembly { get; } Type alcProgramType { get; } IProgram alcProgramInstance { get; } - [MethodImplAttribute(MethodImplOptions.NoInlining)] void RunTestsIsolated(); }