Mash tool: dispose transport before awaiting the link on shutdown
On a wedged (fully silent) board the receive loop sits in a pending net48 serial read that ignores cancellation; awaiting the link before closing the port hangs the tool at run end and loses the summary - exactly what happened on the first real baseline run (the board wedged at 0.62s and stayed dead, so no byte ever completed the read). Close the port first (same order RioCoordinator.Teardown uses); applies to both monitor and --mash modes. Selftest unaffected (its fake transport honors cancellation, which is why it never caught this). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -281,9 +281,13 @@ internal static class MashTest
|
||||
// --- counters AFTER ------------------------------------------------------
|
||||
Dictionary<RioStatusType, int> after = await SnapshotStatusAsync();
|
||||
|
||||
// Dispose the transport BEFORE awaiting the link: on a wedged (silent)
|
||||
// board the receive loop sits in a pending serial read that ignores
|
||||
// cancellation — closing the port is what unblocks it. Awaiting first
|
||||
// hangs forever and eats the summary (seen on the baseline chip run).
|
||||
cts.Cancel();
|
||||
try { await run; } catch { /* shutdown */ }
|
||||
transport.Dispose();
|
||||
try { await run; } catch { /* shutdown */ }
|
||||
|
||||
// --- summary (fixed layout for diffing runs) ------------------------------
|
||||
double mins = Math.Max(sw.Elapsed.TotalMinutes, 0.001);
|
||||
|
||||
@@ -148,9 +148,11 @@ Log(">>> NOW: press the MFD buttons, press keypad keys, and move the axis <<<");
|
||||
Log(">>> a pressed button should light up <<<");
|
||||
|
||||
await Task.Delay(TimeSpan.FromSeconds(seconds));
|
||||
// Transport first: a silent board leaves the receive loop in a pending read
|
||||
// that only the port close unblocks (net48 ReadAsync ignores cancellation).
|
||||
cts.Cancel();
|
||||
try { await run; } catch { /* shutdown */ }
|
||||
transport.Dispose();
|
||||
try { await run; } catch { /* shutdown */ }
|
||||
|
||||
Console.WriteLine();
|
||||
Console.WriteLine("== summary ==");
|
||||
|
||||
Reference in New Issue
Block a user