diff --git a/src/ZB.MOM.WW.ScadaBridge.DataConnectionLayer/Adapters/RealMxGatewayClient.cs b/src/ZB.MOM.WW.ScadaBridge.DataConnectionLayer/Adapters/RealMxGatewayClient.cs
index ac7c7086..22b9de16 100644
--- a/src/ZB.MOM.WW.ScadaBridge.DataConnectionLayer/Adapters/RealMxGatewayClient.cs
+++ b/src/ZB.MOM.WW.ScadaBridge.DataConnectionLayer/Adapters/RealMxGatewayClient.cs
@@ -150,10 +150,16 @@ public sealed class RealMxGatewayClient : IMxGatewayClient
// supervisory subscription may already cover this handle — advise-once).
if (UseSupervisoryAdvise)
await EnsureSupervisoryAdvisedAsync(handle, ct).ConfigureAwait(false);
+ // MXAccess SAFEARRAY writes must supply the attribute's FULL declared
+ // length; a short array (only the N elements the caller provided) is
+ // rejected and the COM write blocks. Pad list values out to the live
+ // array's slot count before encoding (callers signal the valid count
+ // via a separate scalar, e.g. MoveInNumberWorkOrders).
+ var toWrite = await PadArrayToDeclaredSizeAsync(tag, value, ct).ConfigureAwait(false);
entries.Add(new WriteBulkEntry
{
ItemHandle = handle,
- Value = ToMxValue(value),
+ Value = ToMxValue(toWrite),
UserId = _writeUserId,
});
orderedTags.Add(tag);
@@ -356,6 +362,76 @@ public sealed class RealMxGatewayClient : IMxGatewayClient
return handle;
}
+ ///
+ /// MXAccess fixed-size SAFEARRAY attributes only accept a write that supplies
+ /// the whole array; a short list (just the caller's N elements) is rejected and
+ /// the COM write blocks. For a list value, read the tag's current array to learn
+ /// its slot count and pad the value to that length with element-type defaults
+ /// (empty string / 0 / false / default) — the caller's values fill slots 0..N-1,
+ /// the remainder are cleared. Scalars (and a non-array / unreadable tag) pass
+ /// through unchanged.
+ ///
+ private async Task