Fix Interop/PInvoke/Miscellaneous/HandleRef tests under GCStress (#21131)
authorJeremy Koritzinsky <jkoritzinsky@gmail.com>
Sun, 25 Nov 2018 00:35:17 +0000 (18:35 -0600)
committerGitHub <noreply@github.com>
Sun, 25 Nov 2018 00:35:17 +0000 (18:35 -0600)
commitd07633f53b51a30d294c4afe2b0b7ba5b563c134
tree9736300845814825a110ee86319f3fc63b059a91
parent84a62b1925adee9b8979b36f52834d0cca5d0469
Fix Interop/PInvoke/Miscellaneous/HandleRef tests under GCStress (#21131)

* Add GC.KeepAlive call in the IL stub when marshalling a HandleRef.

* Add a GC.KeepAlive call for the BoxedInt since it isn't kept alive when running GC Stress

* Reference HandleRef._handle via the binder instead of by field offset arithmetic

* Alignment

* Use Marshal.Alloc/FreeHGlobal instead of the weird no-pinning machinery that was failing before

* Update HandleRefTest.cs
src/vm/ilmarshalers.cpp
src/vm/mscorlib.h
tests/src/Interop/PInvoke/Miscellaneous/HandleRef/HandleRefTest.cs