You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Update TestHandleCollector() test
Initialize local member in HandleCollector
since it was the only one not initialized.
Update test to wait for pending finalizers since that is when
the HandleCollector API will trigger the GC.
Co-authored-by: Elinor Fung <[email protected]>
Copy file name to clipboardExpand all lines: src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/HandleCollectorTests.cs
+12-3Lines changed: 12 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -122,26 +122,35 @@ public static void Add_Overflows_ThrowsInvalidOperationException()
// HandleLimitTester does the decrement on the HandleCollector during finalization, so we wait for pending finalizers.
134
+
GC.WaitForPendingFinalizers();
133
135
134
-
Assert.True(initialGcState.gen0+initialGcState.gen1+initialGcState.gen2<postLowLimitState.gen0+postLowLimitState.gen1+postLowLimitState.gen2,"Low limit handle did not trigger a GC");
Assert.True(postLowLimitState.gen0+postLowLimitState.gen1+postLowLimitState.gen2<postHighLimitState.gen0+postHighLimitState.gen1+postHighLimitState.gen2,"High limit handle did not trigger a GC");
153
+
Assert.True(postLowLimitSum<postHighLimitSum,$"High limit handle did not trigger a GC: {postLowLimitSum} < {postHighLimitSum}");
0 commit comments