ndisapi.net icon indicating copy to clipboard operation
ndisapi.net copied to clipboard

The Waithandle array cannot be empty

Open Elikar-KM opened this issue 4 years ago • 2 comments

Hello, Your project is awesome, i come to try it in my windows 10 x64, and i get some error:: i added ndisapi.dll for x64 from this project: https://github.com/Detrav/WinpkFilterWrapper. In the demo project this the error: var t1 = Task.Factory.StartNew(() => PassThruThread(filter, waitHandles, tcpAdapters.ToArray(), waitHandlesManualResetEvents)); Task.WaitAll(t1);

And i get this Exception: Loaded driver: 0.0.0.0.

Unhandled exception: System.AggregateException: One or more errors have occurred. ---> System.ArgumentException: The Waithandle array cannot be empty.    at System.Threading.WaitHandle.WaitAny (WaitHandle [] waitHandles, Int32 millisecondsTimeout, Boolean exitContext)    to NdisApiDemo.Program.PassThruThread (NdisApi filter, WaitHandle [] waitHandles, IReadOnlyList1 networkAdapters, IReadOnlyList1 waitHandlesManualResetEvents) in D: \ ndisapi.net-master \ ndisapi.net-master    to NdisApiDemo.Program. <> c__DisplayClass0_0. <Main> b__0 () in D: \ ndisapi.net-master \ ndisapi.net-master \ NdisApiDemo \ Program.cs: line 62    at System.Threading.Tasks.Task.Execute ()    --- End of the internal exception stack trace ---    at System.Threading.Tasks.Task.WaitAll (Task [] tasks, Int32 millisecondsTimeout, CancellationToken cancellationToken)    at System.Threading.Tasks.Task.WaitAll (Task [] tasks, Int32 millisecondsTimeout)    at System.Threading.Tasks.Task.WaitAll (Task [] tasks)    to NdisApiDemo.Program.Main () in D: \ ndisapi.net-master \ ndisapi.net-master \ NdisApiDemo \ Program.cs: line 63.

Elikar-KM avatar May 20 '20 20:05 Elikar-KM

If this is still relevant, I believe it was caused by none of the network adapters being "valid", so the waitHandles array being passed to the callback thread, and then to WaitHandle.WaitAny leads to the System.ArgumentException: The Waithandle array cannot be empty. exception.

DorCoMaNdO avatar Jan 10 '22 16:01 DorCoMaNdO

You need later driver version, get it from official site.

RataplanNL avatar Jan 20 '22 13:01 RataplanNL