I have async Task<string> ReadDeviceAsync(), which awaits a network read. From a button click handler I call it synchronously with var text = ReadDeviceAsync().Result;, because the handler was not async. The window freezes permanently on that line. The same code in a console test program returns normally.
The device does reply, as I can see in a network capture, so why does the call never return in the GUI application, and what is the correct way to call async code from an event handler?




