From d7a8f49658785c3e285afba49d186935950c57ec Mon Sep 17 00:00:00 2001 From: Gene Date: Tue, 19 Sep 2023 12:39:27 +0200 Subject: [PATCH] v1.4.0-beta.49 - Fixes bug not allowing to add new automation programs (!) --- src/HomeGenie/Service/Handlers/Automation.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/HomeGenie/Service/Handlers/Automation.cs b/src/HomeGenie/Service/Handlers/Automation.cs index 4150c046..c305d54e 100644 --- a/src/HomeGenie/Service/Handlers/Automation.cs +++ b/src/HomeGenie/Service/Handlers/Automation.cs @@ -456,13 +456,14 @@ public void ProcessRequest(MigClientRequest request) if (newProgram != null) { newProgram.Address = homegenie.ProgramManager.GeneratePid(); + // add new program: this must be done before compiling, otherwise will throw an error due to HomeGenie service reference not set + homegenie.ProgramManager.ProgramAdd(newProgram); if (newProgram.Type.ToLower() == "visual" || newProgram.Type.ToLower() == "csharp") { (newProgram.Engine as CSharpEngine)?.CleanupFiles(); (newProgram.Engine as CSharpEngine)?.Compile(); } newProgram.IsEnabled = true; - homegenie.ProgramManager.ProgramAdd(newProgram); homegenie.UpdateProgramsDatabase(); request.ResponseData = new ResponseText(newProgram.Address.ToString()); }