Hello Carlo,
you are using WaitForSlotEvent() in blocking mode (first argument "dontBlock" is set to false) and I can confirm I've seen PKCS#11 libraries that behave strangely in this mode: some libraries did detect event many seconds after it occurred, others did report more than one event for just one physical card insertion/removal etc. This is not Pkcs11Interop issue. It is problem of unmanaged PKCS#11 library.
I have created a simple console application that demonstrates WaitForSlotEvent() in non-blocking mode:
using System;
using Net.Pkcs11Interop.HighLevelAPI;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
using (Pkcs11 pkcs11 = new Pkcs11("siecap11.dll", true))
{
while (true)
{
bool eventOccured = false;
ulong slotId = 0;
pkcs11.WaitForSlotEvent(true, out eventOccured, out slotId);
if (eventOccured)
Console.WriteLine("{0:u} - Event occured in slot {1}", DateTime.UtcNow, slotId);
}
}
}
}
}
I have also tested this application on my system with two readers and it produced following output: