Change ConditionalWeakTable.Clear
authorStephen Toub <stoub@microsoft.com>
Sat, 10 Dec 2016 00:00:50 +0000 (19:00 -0500)
committerStephen Toub <stoub@microsoft.com>
Sat, 10 Dec 2016 00:00:50 +0000 (19:00 -0500)
commit630a2338d9f4ad32c9d5c6d1b014ddaef73c9515
treea326fb3a658294bade00b359fc84f485a4717d22
parent6755aed9fdae884d032c03f01c1238cca260958d
Change ConditionalWeakTable.Clear

The original CoreRT implementation just dropped the current table and replaced it with a new one.  In the process of porting the CoreRT implementation to CoreCLR, I'd changed it to instead remove each item from the table (by setting its hashcode to -1, as does Remove), in order to work around some code in the finalizer that would null out te parent's reference to the container, and that would cause problems with dropping this table... but that code in the finalizer changed before it got merged, and in its current form, the old CoreRT clear implementation was fine.  It's also likely better, as it'll let the handles be cleaned up earlier, and it's simple.  So reverting back to it.

Commit migrated from https://github.com/dotnet/coreclr/commit/f084f1c71cf15a8dc918630bd95912f9bd720098
src/coreclr/src/mscorlib/src/System/Runtime/CompilerServices/ConditionalWeakTable.cs