Stack Overflow for Teams A private, secure home for your team’symbiont bitcoin calculator questions and answers. M9 1a8 8 0 1 0 0 16A8 8 0 0 0 9 1zm.
How to wait for async method to complete? My application uses the excellent Generic HID library v6. 0 which can be found here. When my code drops out of the while loop, I need to read some data from the device. Can anyone clarify the behavior that I’m seeing? Have your methods return Task instead of void.
I was scratching my head on a similar issue and the difference was to change void to Task just as you had said. It’s a minor thing, but to follow the convention both methods should have Async added to their names, e. The most important thing to know about async and await is that await doesn’t wait for the associated call to complete. For pedagogical use only: in general, don’t do this! The answer at “await” doesn’t wait for the completion of call has several, more detailed, explanations of these keywords. Stephen Cleary’s guidance about async void holds. Richard Cook – thank you very much for the additional explanation!