Fix GC holes in array marshallers in the field scenario (dotnet/coreclr#27562)
authorJeremy Koritzinsky <jekoritz@microsoft.com>
Fri, 1 Nov 2019 20:21:36 +0000 (13:21 -0700)
committerGitHub <noreply@github.com>
Fri, 1 Nov 2019 20:21:36 +0000 (13:21 -0700)
commit4d3b7822e6d8caddb1cf886b3cf32157fdab1443
treefd933d5a41f6d1e84fb591b9113b8a08273ea9da
parentc084b79ac036e209b6d26d28405fcec9939f54d5
Fix GC holes in array marshallers in the field scenario (dotnet/coreclr#27562)

* Correctly protect references to objects in manually-managed code called by IL marshalers in the field scenarios. Use RuntimeHelpers.GetRawData to simplify layout class marshalling.

* Add additional protects for SAFEARRAY marshalling when used in the field scenario.

* Remove dead code.

* Fix possible GC hole from order of argument evaluation.

* Don't clean up fields on a managed object when there's no managed object.

Commit migrated from https://github.com/dotnet/coreclr/commit/e658b97990f77dca2dba446386e9d8d4d71556e1
src/coreclr/src/vm/ilmarshalers.cpp
src/coreclr/src/vm/ilmarshalers.h
src/coreclr/src/vm/mscorlib.h
src/coreclr/src/vm/olevariant.cpp