diff --git a/tests/Drivers/ZB.MOM.WW.OtOpcUa.Driver.Modbus.Tests/ModbusWritePduFramingTests.cs b/tests/Drivers/ZB.MOM.WW.OtOpcUa.Driver.Modbus.Tests/ModbusWritePduFramingTests.cs
index bc125c3f..5744cca5 100644
--- a/tests/Drivers/ZB.MOM.WW.OtOpcUa.Driver.Modbus.Tests/ModbusWritePduFramingTests.cs
+++ b/tests/Drivers/ZB.MOM.WW.OtOpcUa.Driver.Modbus.Tests/ModbusWritePduFramingTests.cs
@@ -1,3 +1,4 @@
+using System.Collections.Concurrent;
using Shouldly;
using Xunit;
using ZB.MOM.WW.OtOpcUa.Core.Abstractions;
@@ -16,16 +17,20 @@ public sealed class ModbusWritePduFramingTests
{
private const string Ref = "arr";
- /// Records every PDU; answers reads with zeros and multi-writes with the standard echo.
+ ///
+ /// Records every PDU; answers reads with zeros and multi-writes with the standard echo. The record is a
+ /// concurrent queue: a plain List lost the FC16 PDU on hosted CI (run 2243, "Sequence contains no
+ /// matching element") when the default-on probe loop's FC03 Add raced the write's Add.
+ ///
private sealed class CapturingTransport : IModbusTransport
{
- public readonly List Sent = [];
+ public readonly ConcurrentQueue Sent = new();
public Task ConnectAsync(CancellationToken ct) => Task.CompletedTask;
public Task SendAsync(byte unitId, byte[] pdu, CancellationToken ct)
{
- Sent.Add(pdu);
+ Sent.Enqueue(pdu);
var qty = (pdu[3] << 8) | pdu[4];
return Task.FromResult(pdu[0] switch
{
@@ -42,10 +47,13 @@ public sealed class ModbusWritePduFramingTests
private static async Task WriteAndCaptureAsync(string tagConfig, object value, byte functionCode, bool fc23 = false)
{
var transport = new CapturingTransport();
- var drv = new ModbusDriver(
+ // The probe is off: these tests assert on the write's own PDU, and a background probe loop sending FC03
+ // concurrently from a pool thread is noise at best (and was a lost-PDU race against the old List record).
+ await using var drv = new ModbusDriver(
new ModbusDriverOptions
{
Host = "fake", RawTags = [new RawTagEntry(Ref, tagConfig, false)], UseFC23ForMultiRegisterWrites = fc23,
+ Probe = new ModbusProbeOptions { Enabled = false },
},
"modbus-framing", _ => transport);
await drv.InitializeAsync("{}", CancellationToken.None);