private void Dispose(bool isDisposing) { if (isDisposing) { _hookId.Dispose(); } _hookedProc = null; }
public static void SafeHandle_invalid() { MySafeHandle mch = new MySafeHandle(); Assert.False(mch.IsClosed); Assert.True(mch.IsInvalid); Assert.False(mch.IsReleased); Assert.Equal(IntPtr.Zero, mch.DangerousGetHandle()); mch.Dispose(); Assert.True(mch.IsClosed); Assert.True(mch.IsInvalid); Assert.False(mch.IsReleased); // Make sure we can dispose multiple times mch.Dispose(); Assert.True(mch.IsClosed); Assert.True(mch.IsInvalid); Assert.False(mch.IsReleased); }
public static void SafeHandle_valid() { MySafeHandle mch = new MySafeHandle(new IntPtr(1)); Assert.False(mch.IsClosed); Assert.False(mch.IsInvalid); Assert.False(mch.IsReleased); mch.Dispose(); Assert.True(mch.IsClosed); Assert.False(mch.IsInvalid); Assert.True(mch.IsReleased); }