[corlib] Two small fixes for GCHandle
authorAlexander Köplinger <alex.koeplinger@outlook.com>
Mon, 28 Mar 2016 17:59:06 +0000 (19:59 +0200)
committerAlexander Köplinger <alex.koeplinger@outlook.com>
Mon, 28 Mar 2016 18:00:57 +0000 (20:00 +0200)
commitd69f4d14e9d1fa68aa077350b5ec79e670f507d5
tree7c3999f38b9f3d3f5daab703f64e10639cbb065a
parent9cc0c474c6d065a2f5f9663782fbe7df3f85e112
[corlib] Two small fixes for GCHandle

1) Free() throws on MS.NET when the handle was already freed, copied and adapted the referencesource implementation.

2) Explicit conversion from IntPtr to GCHandle throws InvalidOperationException when value is IntPtr.Zero on MS.NET, not ArgumentException.

This fixes two failing CoreCLR test cases.
mcs/class/corlib/System.Runtime.InteropServices/GCHandle.cs