Skip to content

Commit

Permalink
[MTGOSDK/Core] Teardown RemoteClient on unhandled exception
Browse files Browse the repository at this point in the history
  • Loading branch information
Qonfused committed Dec 25, 2023
1 parent 55c2cec commit 3dfcfad
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions MTGOSDK/src/Core/RemoteClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,9 @@ private RemoteApp GetClientHandle()
var port = RemoteClient.Port ??= (ushort)_clientProcess.Id;
var client = RemoteApp.Connect(_clientProcess, port);

// Teardown on exception.
AppDomain.CurrentDomain.UnhandledException += (s, e) => this.Dispose();

// Verify that the injected assembly is loaded and reponding
if (client.Communicator.CheckAliveness() is false)
throw new TimeoutException(
Expand Down

0 comments on commit 3dfcfad

Please sign in to comment.