perevoznyk / swelio-sdk

Belgian eID card SDK for .NET and C++
MIT License
28 stars 11 forks source link

reaction very slow #14

Open dieterQBIT opened 2 years ago

dieterQBIT commented 2 years ago

I'm having a hard time using the events. Every time I set engine.TraceEvents = true, the program is running slow as hell, including the EIDTestApp you created.

As soon I put it to false I can get to work to read a card, but as soon I switch a card it's over.

What am I doing wrong? I'm using the latest version.

dieterQBIT commented 2 years ago

I noticed I might be in an endless loop of CardEvent.ReadersChange but I don't know why. I'm not doing anything. My real cardreader is not even connected.

perevoznyk commented 2 years ago

It could be hardware-related problem.

In code of event activation

private void ActivateCardEventsTracing()
        {
            engine.CardInserted += new EventHandler<CardEventArgs>(engine_CardInserted);
            engine.CardRemoved += new EventHandler<CardEventArgs>(engine_CardRemoved);
            engine.ReadersListChanged += new EventHandler(engine_ReadersListChanged);
            engine.TraceHardwareEvents = true;
            engine.TraceServiceEvents = true;
            engine.TraceEvents = true;
        }

change engine.TraceHardwareEvents = false; You can also try engine.TraceServiceEvents = false;

This would stop triggering reactions on card readers list change. It is possible that your PC / laptop has built-in card reader for another type of cards, for example SD card reader. But all types of card readers use the same Windows API and sometime it may lead to such result.

dieterQBIT commented 2 years ago

I was thinking in the same direction. Strange thing is, my colleagues have the exact same laptop (DELL Latidude 5590 on W11) and I'm the only having this problem. However, engine.TraceHardwareEvents = false; did the trick, tnx!

perevoznyk commented 2 years ago

@dieterQBIT Has your laptop SIM card slot or SD card reader built-in?

dieterQBIT commented 2 years ago

Yes, there is a SD-card reader built-in. I've also noticed Windows Hello is also recognized as a card device with a card. But as said, my colleague has exact the same setup and he didn't have the issue.

WesleyHendrickx commented 1 year ago

It's related to windows Hello.

I encountered the same issue and it even depends on how Windows Hello 4 Business is "activated". I've seen a situation where on 2 exact the same pc configurations one had the issue and another didn't.

In fact the virtual card related to Windows hello causes an error from a slot event which in turn causes yet another slotevent and the library keeps on looping in these slotevents.

We solved it by completely ignoring the Windows Hello virtual cards... Both on the listreaders as on the Removed and Inserted events...

stevenvanrossem commented 1 year ago

We also encountered the issue on some Windows PCs joined in an Azure domain. Windows creates some kind of virtual smartcard reader named 'windows hello for business' (not visible via device manager, but still visible via the swelio listReaders function). We could also solve the issue by ignoring this virtual card reader (by the cardreader index) in all events in the callbackhandler... Maybe it is possible to detect 'valid' card readers some other way?

perevoznyk commented 1 year ago

When loading the list of the readers I skipped now Hello reader and think this can resolve the problem. Can someone test it, please?

timmessi87 commented 7 months ago

We've updates to version 29 and the problem still occurs... We've disabled TraceHardWareEvents and then everything works.