fix: handle mixed JSON types in data connection config deserialization

DeploymentManagerActor deserialized connection config JSON as
Dictionary<string, string>, 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.
This commit is contained in:
Joseph Doherty
2026-03-18 00:39:01 -04:00
parent 68115e7e38
commit 88b5f6cb54

View File

@@ -375,8 +375,12 @@ public class DeploymentManagerActor : ReceiveActor, IWithTimers
{
try
{
var parsed = System.Text.Json.JsonSerializer.Deserialize<Dictionary<string, string>>(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 */ }
}