diff --git a/X10D/src/WaitHandleExtensions/WaitHandleExtensions.cs b/X10D/src/WaitHandleExtensions/WaitHandleExtensions.cs index c075e31..97fbff1 100644 --- a/X10D/src/WaitHandleExtensions/WaitHandleExtensions.cs +++ b/X10D/src/WaitHandleExtensions/WaitHandleExtensions.cs @@ -1,4 +1,5 @@ -using System.Threading; +using System; +using System.Threading; using System.Threading.Tasks; namespace X10D @@ -15,7 +16,12 @@ namespace X10D /// A task which encapsulates . public static Task WaitOneAsync(this WaitHandle handle) { - return new(() => handle.WaitOne()); + if (handle is null) + { + throw new ArgumentNullException(nameof(handle)); + } + + return new Task(() => handle.WaitOne()); } } }