From 5581c712eb457aa4f266498e69816539dad2a2d9 Mon Sep 17 00:00:00 2001 From: David Hall Date: Thu, 29 Aug 2019 19:56:08 -0600 Subject: [PATCH] Fixed bug with implicit conversion to SafeEventHandle from SafeWaitHandle. Should have been EventWaitHandle. --- PInvoke/Kernel32/SynchApi.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/PInvoke/Kernel32/SynchApi.cs b/PInvoke/Kernel32/SynchApi.cs index ad7cec00..29efda33 100644 --- a/PInvoke/Kernel32/SynchApi.cs +++ b/PInvoke/Kernel32/SynchApi.cs @@ -3,6 +3,7 @@ using System; using System.Collections.Generic; using System.Linq; using System.Runtime.InteropServices; +using System.Threading; using Vanara.Extensions; using Vanara.InteropServices; using FILETIME = System.Runtime.InteropServices.ComTypes.FILETIME; @@ -2363,10 +2364,12 @@ namespace Vanara.PInvoke /// public bool Set() => SetEvent(this); - /// Performs an implicit conversion from to . +#pragma warning disable CS0618 // Type or member is obsolete + /// Performs an implicit conversion from to . /// The SafeSyncHandle instance. /// The result of the conversion. - public static implicit operator SafeEventHandle(SafeWaitHandle h) => new SafeEventHandle(h.DangerousGetHandle(), false); + public static implicit operator SafeEventHandle(EventWaitHandle h) => new SafeEventHandle(h.Handle, false); +#pragma warning restore CS0618 // Type or member is obsolete /// Gets an invalid event handle. public static SafeEventHandle InvalidHandle => new SafeEventHandle(new IntPtr(-1), false);