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:
@@ -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 */ }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user