From d4f1fecc64e5090a9aa1f5043943c3f044055ab3 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 9 Jun 2026 17:11:18 +0000 Subject: [PATCH] fix: register ComPort shutdown hook after initialization --- .../Comm and IR/ComPortController.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/PepperDash.Essentials.Core/Comm and IR/ComPortController.cs b/src/PepperDash.Essentials.Core/Comm and IR/ComPortController.cs index 0bc71c62..e6a9773f 100644 --- a/src/PepperDash.Essentials.Core/Comm and IR/ComPortController.cs +++ b/src/PepperDash.Essentials.Core/Comm and IR/ComPortController.cs @@ -52,7 +52,6 @@ namespace PepperDash.Essentials.Core ComPort.ComPortSpec spec, EssentialsControlPropertiesConfig config) : base(key) { StreamDebugging = new CommunicationStreamDebugging(key); - CrestronEnvironment.ProgramStatusEventHandler += CrestronEnvironment_ProgramStatusEventHandler; Spec = spec; @@ -62,6 +61,8 @@ namespace PepperDash.Essentials.Core RegisterAndConfigureComPort(); }); + + CrestronEnvironment.ProgramStatusEventHandler += CrestronEnvironment_ProgramStatusEventHandler; } /// @@ -73,8 +74,6 @@ namespace PepperDash.Essentials.Core public ComPortController(string key, ComPort port, ComPort.ComPortSpec spec) : base(key) { - CrestronEnvironment.ProgramStatusEventHandler += CrestronEnvironment_ProgramStatusEventHandler; - if (port == null) { Debug.LogMessage(LogEventLevel.Information, this, "ERROR: Invalid com port, continuing but comms will not function"); @@ -86,6 +85,7 @@ namespace PepperDash.Essentials.Core //IsConnected = new BoolFeedback(CommonBoolCue.IsConnected, () => true); RegisterAndConfigureComPort(); + CrestronEnvironment.ProgramStatusEventHandler += CrestronEnvironment_ProgramStatusEventHandler; } private void RegisterAndConfigureComPort()