Fix SafeHandle marshalling in ref/in/out parameters (#17330)
commit0c02bb1207af75c176c369e411d9f4407e21030d
authorFilip Navara <navara@emclient.com>
Wed, 16 Oct 2019 05:43:42 +0000 (16 07:43 +0200)
committerZoltan Varga <vargaz@gmail.com>
Wed, 16 Oct 2019 05:43:42 +0000 (16 01:43 -0400)
treef2030a93faa01e14f006e6096c5b58d59bc4a163
parentd4d93b9699f0f903befb5a72ea928cf5e1f4ac6c
Fix SafeHandle marshalling in ref/in/out parameters (#17330)

* Fix SafeHandle marshalling in ref/in/out parameters

* Reorder code to make it exception safe, update comments

* Revert the code reordering because it breaks the invariant that new handle returned from native code should always create new SafeHandle on the managed side

* Fix test_0_safehandle_ref test. The test was expecting incorrect behavior, verified on .NET Core 3 and .NET Framework 4.8.

* Address PR feedback

* Fix cut & paste error

* Fix build

* Really fix the test_0_safehandle_ref tests

* Add more tests for SafeHandle marshalling

* Add exclusion for broken CoreFX test
mono/metadata/marshal-ilgen.c
mono/tests/libtest.c
mono/tests/safehandle.2.cs
netcore/CoreFX.issues.rsp