Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Ap0k committed May 27, 2021
1 parent e84185e commit 48d24ec
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/tests/Loader/ContextualReflection/ContextualReflection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -729,14 +729,14 @@ void TestActivatorCreateInstance(bool isolated)
void TestDefineDynamicAssembly(bool collectibleContext, AssemblyBuilderAccess assemblyBuilderAccess)
{
AssemblyLoadContext assemblyLoadContext = collectibleContext ? new AssemblyLoadContext("DynamicAssembly Collectable context", true) : AssemblyLoadContext.Default;
AssemblyName dynamicAssemblyName = new AssemblyName("DynamicAssembly");
AssemblyBuilder assemblyBuilder;

using (assemblyLoadContext.EnterContextualReflection())
{
AssemblyBuilder assemblyBuilder = AssemblyBuilder.DefineDynamicAssembly(dynamicAssemblyName, assemblyBuilderAccess);
assemblyBuilder = AssemblyBuilder.DefineDynamicAssembly(new AssemblyName($"DynamicAssembly_{Guid.NewGuid():N}"), assemblyBuilderAccess);
}

Assert.IsTrue(assemblyLoadContext.Assemblies.Any(a => AssemblyName.ReferenceMatchesDefinition(a.GetName(), dynamicAssemblyName)));
Assert.IsTrue(assemblyLoadContext.Assemblies.Any(a => AssemblyName.ReferenceMatchesDefinition(a.GetName(), assemblyBuilder.GetName())));
}

void TestMockAssemblyThrows()
Expand All @@ -752,9 +752,8 @@ public void RunTests()
VerifyUsingStatementContextualReflectionUsage();
VerifyBadContextualReflectionUsage();

// TestDynamicAssembly() disabled due to https://github.com/dotnet/runtime/issues/48579
//TestDynamicAssembly(true);
//TestDynamicAssembly(false);
TestDynamicAssembly(true);
TestDynamicAssembly(false);

RunTests(isolated : false);
alcProgramInstance.RunTestsIsolated();
Expand Down

0 comments on commit 48d24ec

Please sign in to comment.