From 677aed6ef93dfa1aae02b20fd6aa16bfe9f71d2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20H=C3=B6glinger-Stelzer?= Date: Sun, 25 Nov 2018 14:37:08 +0100 Subject: [PATCH] Resolved handle warnings --- PInvokeSerialPort/SerialPort.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/PInvokeSerialPort/SerialPort.cs b/PInvokeSerialPort/SerialPort.cs index 2c591ad..08b551b 100755 --- a/PInvokeSerialPort/SerialPort.cs +++ b/PInvokeSerialPort/SerialPort.cs @@ -401,7 +401,7 @@ namespace PInvokeSerialPort _checkSends = CheckAllSends; wo.Offset = 0; wo.OffsetHigh = 0; - wo.hEvent = _checkSends ? _writeEvent.Handle : IntPtr.Zero; + wo.hEvent = _checkSends ? _writeEvent.SafeWaitHandle.DangerousGetHandle() : IntPtr.Zero; _ptrUwo = Marshal.AllocHGlobal(Marshal.SizeOf(wo)); Marshal.StructureToPtr(wo, _ptrUwo, true); _writeCount = 0; @@ -686,7 +686,7 @@ namespace PInvokeSerialPort var unmanagedOv = Marshal.AllocHGlobal(Marshal.SizeOf(ov)); ov.Offset = 0; ov.OffsetHigh = 0; - ov.hEvent = sg.Handle; + ov.hEvent = sg.SafeWaitHandle.DangerousGetHandle(); Marshal.StructureToPtr(ov, unmanagedOv, true); uint eventMask = 0;