From 88b5f6cb54a101ca3fb47c2879ecbced5fbfed01 Mon Sep 17 00:00:00 2001 From: Joseph Doherty Date: Wed, 18 Mar 2026 00:39:01 -0400 Subject: [PATCH] fix: handle mixed JSON types in data connection config deserialization DeploymentManagerActor deserialized connection config JSON as Dictionary, which silently failed on non-string values like {"publishInterval":1000}. The OPC UA adapter then fell back to localhost:4840 (unreachable in Docker). Now uses JsonDocument to handle any JSON value type. OPC PLC Simulator connects successfully. --- .../Actors/DeploymentManagerActor.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/ScadaLink.SiteRuntime/Actors/DeploymentManagerActor.cs b/src/ScadaLink.SiteRuntime/Actors/DeploymentManagerActor.cs index 704f463..f4e69a1 100644 --- a/src/ScadaLink.SiteRuntime/Actors/DeploymentManagerActor.cs +++ b/src/ScadaLink.SiteRuntime/Actors/DeploymentManagerActor.cs @@ -375,8 +375,12 @@ public class DeploymentManagerActor : ReceiveActor, IWithTimers { try { - var parsed = System.Text.Json.JsonSerializer.Deserialize>(connConfig.ConfigurationJson); - if (parsed != null) connectionDetails = parsed; + // Parse as JsonElement to handle mixed value types (string, int, bool) + using var doc = System.Text.Json.JsonDocument.Parse(connConfig.ConfigurationJson); + foreach (var prop in doc.RootElement.EnumerateObject()) + { + connectionDetails[prop.Name] = prop.Value.ToString(); + } } catch { /* Ignore parse errors */ } }