{
get
{
- return (handle != 0);
+ return (handle != -1);
}
}
IntPtr res = GetAddrOfPinnedObject(handle);
if (res == IntPtr.Zero)
throw new InvalidOperationException("The handle is not of Pinned type");
+ if (res == (IntPtr)(-1))
+ throw new ArgumentException ("Object contains non-primitive or non-blittable data.");
return res;
}
public void Free()
{
FreeHandle(handle);
- handle = 0;
+ handle = -1;
}
public static explicit operator IntPtr (GCHandle value)