fix(lmxproxy): handle DateTime[] COM arrays in TypedValueConverter
DateTime[] from MxAccess was falling through to ToString() fallback, producing "System.DateTime[]" instead of actual values. Now converts each DateTime to UTC ticks and stores in Int64Array. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -107,6 +107,13 @@ namespace ZB.MOM.WW.LmxProxy.Host.Domain
|
||||
return new Scada.TypedValue { ArrayValue = new Scada.ArrayValue { StringValues = arr } };
|
||||
}
|
||||
|
||||
case DateTime[] dtArr:
|
||||
{
|
||||
var arr = new Scada.Int64Array();
|
||||
arr.Values.AddRange(Array.ConvertAll(dtArr, dt => dt.ToUniversalTime().Ticks));
|
||||
return new Scada.TypedValue { ArrayValue = new Scada.ArrayValue { Int64Values = arr } };
|
||||
}
|
||||
|
||||
default:
|
||||
// VT_UNKNOWN or any unrecognized type — ToString() fallback
|
||||
Log.Warning("Unrecognized COM variant type {Type}, using ToString() fallback", value.GetType().Name);
|
||||
|
||||
Reference in New Issue
Block a user