diff --git a/Program.cs b/Program.cs index fe7d93e..c6fad62 100644 --- a/Program.cs +++ b/Program.cs @@ -196,12 +196,12 @@ static async Task Main(string[] args) return code; } - private void Finish() + private static void Finish() { - if(device != null) - await device.Disconnect(); - if(conn != null) - await conn.Disconnect(); + if (device != null) + device.Disconnect().Wait(); // Use .Wait() to synchronously wait for completion. Deadlocks uncritical here, because the program is exiting anyway. + if (conn != null) + conn.Disconnect().Wait(); }