Exemplo n.º 1
0
        public void Assembly_IsCollectibleTrue_WhenUsingAssemblyLoadContext()
        {
            RemoteInvoke(() => {
                AssemblyLoadContext alc = new TestAssemblyLoadContext();

                Assembly asm = alc.LoadFromAssemblyPath(asmPath);

                Assert.NotNull(asm);

                Assert.True(asm.IsCollectible);

                return(SuccessExitCode);
            }).Dispose();
        }
Exemplo n.º 2
0
        public void GenericWithCollectibleTypeParameter_IsCollectibleTrue_WhenUsingAssemblyLoadContext()
        {
            RemoteExecutor.Invoke(() =>
            {
                AssemblyLoadContext alc = new TestAssemblyLoadContext();

                Type t1 = Type.GetType(
                    "System.Collections.Generic.Dictionary`2[[System.Int32],[TestCollectibleAssembly.MyTestClass, TestCollectibleAssembly, Version=1.0.0.0]]",
                    collectibleAssemblyResolver(alc),
                    typeResolver(false),
                    true
                    );

                Assert.NotNull(t1);

                Assert.True(t1.IsCollectible);
            }).Dispose();
        }
Exemplo n.º 3
0
        public void Assembly_IsCollectibleTrue_WhenUsingTestAssemblyLoadContext()
        {
            RemoteExecutor.Invoke(() => {
                AssemblyLoadContext alc = new TestAssemblyLoadContext();

                Assembly asm = alc.LoadFromAssemblyPath(asmPath);

                Assert.NotNull(asm);

                Assert.True(asm.IsCollectible);
                Assert.True(alc.IsCollectible);

                Assert.Null(alc.Name);
                Assert.Contains("\"\"", alc.ToString());
                Assert.Contains("System.Reflection.Tests.TestAssemblyLoadContext", alc.ToString());
                Assert.Contains(alc, AssemblyLoadContext.All);
                Assert.Contains(asm, alc.Assemblies);
            }).Dispose();
        }
Exemplo n.º 4
0
        public void MemberInfoGeneric_IsCollectibleTrue_WhenUsingAssemblyLoadContext(string memberName)
        {
            RemoteExecutor.Invoke((marshalledName) =>
            {
                AssemblyLoadContext alc = new TestAssemblyLoadContext();

                Type t1 = Type.GetType(
                    "TestCollectibleAssembly.MyGenericTestClass`1[System.Int32], TestCollectibleAssembly, Version=1.0.0.0",
                    collectibleAssemblyResolver(alc),
                    typeResolver(false),
                    true
                    );

                Assert.NotNull(t1);

                var member = t1.GetMember(marshalledName).FirstOrDefault();

                Assert.NotNull(member);

                Assert.True(member.IsCollectible);
            }, memberName).Dispose();
        }
Exemplo n.º 5
0
        public void Assembly_IsCollectibleTrue_WhenUsingTestAssemblyLoadContext()
        {
            RemoteInvoke(() => {
                AssemblyLoadContext alc = new TestAssemblyLoadContext();

                Assembly asm = alc.LoadFromAssemblyPath(asmPath);

                Assert.NotNull(asm);

                Assert.True(asm.IsCollectible);
                Assert.True(alc.IsCollectible);

                Assert.Null(alc.Name);
                Assert.Contains("\"\"", alc.ToString());
                Assert.Contains("System.Reflection.Tests.TestAssemblyLoadContext", alc.ToString());
                Assert.Contains(alc, AssemblyLoadContext.All);
#if CoreCLR_23583
                Assert.Contains(asm, alc.Assemblies);
#endif

                return(SuccessExitCode);
            }).Dispose();
        }
Exemplo n.º 6
0
        public void MemberInfo_IsCollectibleTrue_WhenUsingAssemblyLoadContext(string memberName)
        {
            RemoteInvoke((marshalledName) =>
            {
                AssemblyLoadContext alc = new TestAssemblyLoadContext();

                Type t1 = Type.GetType(
                    "TestCollectibleAssembly.MyTestClass, TestCollectibleAssembly, Version=1.0.0.0",
                    collectibleAssemblyResolver(alc),
                    typeResolver(false),
                    true
                    );

                Assert.NotNull(t1);

                var member = t1.GetMember(marshalledName).FirstOrDefault();

                Assert.NotNull(member);

                Assert.True(member.IsCollectible);

                return(SuccessExitCode);
            }, memberName).Dispose();
        }