示例#1
0
        public static void Unload_CollectibleWithNoAssemblyLoaded()
        {
            // Use a collectible ALC + Unload
            // Check that we receive the Unloading event

            var checker = new CollectibleChecker(1);

            CreateAndLoadContext(checker);
            checker.GcAndCheck();
        }
示例#2
0
        public static void Finalizer_CollectibleWithNoAssemblyLoaded()
        {
            // Use a collectible ALC, let the finalizer call Unload
            // Check that we receive the Unloading event

            var checker = new CollectibleChecker(1);
            // Create the ALC in another method to allow the finalizer to run
            WeakReference <AssemblyLoadContext> weakRef = CreateCollectible(checker);

            checker.GcAndCheck();

            // Check that the ALC was also released
            AssemblyLoadContext alc;

            Assert.False(weakRef.TryGetTarget(out alc));
        }
示例#3
0
 public void CheckContextUnloaded()
 {
     // The type should now be unloaded
     _checker.GcAndCheck();
 }