From ac41113853ac5dfeab28ef62d088331c52b5022a Mon Sep 17 00:00:00 2001 From: krjan02 Date: Mon, 13 Jan 2025 22:34:43 +0100 Subject: [PATCH] Fixed Exception when requesting exit --- SoraV2Utils_Agent/ServiceIPC.cs | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/SoraV2Utils_Agent/ServiceIPC.cs b/SoraV2Utils_Agent/ServiceIPC.cs index 8b393bd..8760ca5 100644 --- a/SoraV2Utils_Agent/ServiceIPC.cs +++ b/SoraV2Utils_Agent/ServiceIPC.cs @@ -76,12 +76,19 @@ namespace SoraV2Utils_Agent public void Exit() { - var client = new Client("SoraV2UtilsDeviceData"); - var service = client.GetServiceProxy(); - service.Exit(); + // Stop the Service + try + { + var client = new Client("SoraV2UtilsDeviceData"); + var service = client.GetServiceProxy(); + service.Exit(); + } + catch (TimeoutException) + { + } - // Exit the application gracefully - Environment.Exit(0); + // Exit the application + System.Environment.Exit(1); } } }