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(); }
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)); }
public void CheckContextUnloaded() { // The type should now be unloaded _checker.GcAndCheck(); }