Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MiFare.CardReader.FindAsync is not async and cannot be awaited #14

Open
Bobilas opened this issue Aug 24, 2021 · 0 comments
Open

MiFare.CardReader.FindAsync is not async and cannot be awaited #14

Bobilas opened this issue Aug 24, 2021 · 0 comments

Comments

@Bobilas
Copy link

Bobilas commented Aug 24, 2021

If you attempt calling SmartCardReader reader = await CardReader.FindAsync() and no card reader is connected, you will get "System.NullReferenceException: Object reference not set to an instance of an object.", because it attempts to await null. It should either return Task.FromResult(null), or be rewritten so it's actually async.

The workaround I had to use is SmartCardReader reader = CardReader.FindAsync()?.Result;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant