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

Regression test for https://github.com/dotnet/coreclr/pull/8580 #14402

Merged
merged 1 commit into from
Dec 11, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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