Skip to content

Commit

Permalink
Fixed 'added dispose' since....
Browse files Browse the repository at this point in the history
the Finish method is not marked as static, and it will be called within a static context and
using the Wait method to synchronously wait for the completion of the asynchronous device/conn Disconnect.
  • Loading branch information
GeminiServer committed Jan 24, 2024
1 parent ee33968 commit 9829833
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -196,12 +196,12 @@ static async Task<int> 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();
}


Expand Down

0 comments on commit 9829833

Please sign in to comment.