Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.
/ corefx Public archive

Commit

Permalink
Merge pull request #14402 from jkotas/coreclr-issue-8577
Browse files Browse the repository at this point in the history
Regression test for dotnet/coreclr#8580
  • Loading branch information
stephentoub committed Dec 11, 2016
2 parents 2eada93 + fc6211c commit 462bd27
Showing 1 changed file with 22 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,28 @@ public static void Concurrent_GetValue_Read_Remove_SameObject()
});
}

[Fact]
public static void AddRemove_DropValue()
{
var key = new object();
var value = new object();

var cwt = new ConditionalWeakTable<object, object>();

cwt.Add(key, value);
cwt.Remove(key);

// Verify that the removed entry is not keeping the value alive
var wrValue = new WeakReference(value);
value = null;

GC.Collect();
Assert.False(wrValue.IsAlive);

GC.KeepAlive(cwt);
GC.KeepAlive(key);
}

[Fact]
public static void GetOrCreateValue()
{
Expand Down

0 comments on commit 462bd27

Please sign in to comment.