From b050371dd509185eeaee1aeffbc5223cce55d438 Mon Sep 17 00:00:00 2001 From: Joseph Doherty Date: Sun, 22 Mar 2026 14:56:08 -0400 Subject: [PATCH] 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) --- .../ZB.MOM.WW.LmxProxy.Host/Domain/TypedValueConverter.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lmxproxy/src/ZB.MOM.WW.LmxProxy.Host/Domain/TypedValueConverter.cs b/lmxproxy/src/ZB.MOM.WW.LmxProxy.Host/Domain/TypedValueConverter.cs index 9c033df..30a4314 100644 --- a/lmxproxy/src/ZB.MOM.WW.LmxProxy.Host/Domain/TypedValueConverter.cs +++ b/lmxproxy/src/ZB.MOM.WW.LmxProxy.Host/Domain/TypedValueConverter.cs @@ -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);