Fix Interop/PInvoke/Miscellaneous/HandleRef tests under GCStress (dotnet/coreclr...
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)
commit003b1d368caf7e121e08b7cbeba57d22f2c20854
treef8dc56024a44b733290fca815e26e11eb574cf6d
parent5fc303612affc6c14666b10a8359e8d6bfe3af72
Fix Interop/PInvoke/Miscellaneous/HandleRef tests under GCStress (dotnet/coreclr#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

Commit migrated from https://github.com/dotnet/coreclr/commit/d07633f53b51a30d294c4afe2b0b7ba5b563c134
src/coreclr/src/vm/ilmarshalers.cpp
src/coreclr/src/vm/mscorlib.h
src/coreclr/tests/src/Interop/PInvoke/Miscellaneous/HandleRef/HandleRefTest.cs