diff --git a/tests/MBN_STOCK_WEBVIEW.Playout.Tests/PgmConnectDiagnosticTests.cs b/tests/MBN_STOCK_WEBVIEW.Playout.Tests/PgmConnectDiagnosticTests.cs index 86e635e..756ce51 100644 --- a/tests/MBN_STOCK_WEBVIEW.Playout.Tests/PgmConnectDiagnosticTests.cs +++ b/tests/MBN_STOCK_WEBVIEW.Playout.Tests/PgmConnectDiagnosticTests.cs @@ -400,13 +400,16 @@ public sealed class PgmConnectDiagnosticTests public bool TryPreventKtapConnect() { - PreventionAttempted.Set(); var previous = Interlocked.CompareExchange(ref _dispatchGate, 2, 0); if (previous == 1 && LastKtapConnectState == PlayoutKtapConnectState.NotAttempted) { LastKtapConnectState = PlayoutKtapConnectState.Attempted; } + // Publish the test synchronization point only after the dispatch gate + // is closed. Signalling first lets the blocked safety probe resume and + // race KTAP dispatch before this prevention attempt has taken effect. + PreventionAttempted.Set(); return previous == 0; }