diff options
author | Bruce Forstall <brucefo@microsoft.com> | 2018-01-11 16:22:55 -0800 |
---|---|---|
committer | Bruce Forstall <brucefo@microsoft.com> | 2018-01-11 16:22:55 -0800 |
commit | d087b29b9f68db08e6606a50d8ce2e80fe156dbf (patch) | |
tree | 296ba9a0bde641f91faf2a15bbb11f9981be3242 /tests | |
parent | e275d2dfe18ad1f7db9c35220283001a81a7c669 (diff) | |
download | coreclr-d087b29b9f68db08e6606a50d8ce2e80fe156dbf.tar.gz coreclr-d087b29b9f68db08e6606a50d8ce2e80fe156dbf.tar.bz2 coreclr-d087b29b9f68db08e6606a50d8ce2e80fe156dbf.zip |
Fix GC.KeepAlive test case
In the test, as written, a GC could sneak in between the GC.KeepAlive()
call and the subsequent line that checks whether the finalizer
has run, especially in GC stress modes. Simply move the GC.KeepAlive()
call down.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/src/CoreMangLib/cti/system/gc/gckeepalive.cs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/tests/src/CoreMangLib/cti/system/gc/gckeepalive.cs b/tests/src/CoreMangLib/cti/system/gc/gckeepalive.cs index ed90465171..c8aa542233 100644 --- a/tests/src/CoreMangLib/cti/system/gc/gckeepalive.cs +++ b/tests/src/CoreMangLib/cti/system/gc/gckeepalive.cs @@ -44,13 +44,13 @@ public class GCKeepAlive GC.WaitForPendingFinalizers(); GC.Collect(); - GC.KeepAlive(tc); if (TestClass.m_TestInt != 1) { TestLibrary.TestFramework.LogError("001.1", "Calling KeepAlive can not prevent an object to be GCed"); TestLibrary.TestFramework.LogInformation("WARNING [LOCAL VARIABLE] TestClass.m_TestInt = " + TestClass.m_TestInt); retVal = false; } + GC.KeepAlive(tc); } catch (Exception e) { |