Skip to content

Commit

Permalink
Ensure RemoteInvokeHandle is disposed
Browse files Browse the repository at this point in the history
  • Loading branch information
rokonec committed Jun 6, 2024
1 parent 6575440 commit cb3a84c
Showing 1 changed file with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -330,8 +330,16 @@ public async Task DuplicateAndClose_TcpServerHandler(AddressFamily addressFamily
else
{
RemoteInvokeHandle hServerProc = RemoteExecutor.Invoke(HandlerServerCode, _ipcPipeName);
await RunCommonHostLogic(hServerProc.Process.Id);
await hServerProc.DisposeAsync();

// Since RunCommonHostLogic can throw, we need to make sure the server process is disposed
try
{
await RunCommonHostLogic(hServerProc.Process.Id);
}
finally
{
await hServerProc.DisposeAsync();
}
}

async Task RunCommonHostLogic(int processId)
Expand Down

0 comments on commit cb3a84c

Please sign in to comment.