Skip to content

Allow a recording to be started again once consumed - #1896

Merged
SimonCropp merged 2 commits into
mainfrom
fix-recording-restart
Aug 30, 2026
Merged

Allow a recording to be started again once consumed#1896
SimonCropp merged 2 commits into
mainfrom
fix-recording-restart

Conversation

@SimonCropp

Copy link
Copy Markdown
Member

TryStop runs inside the engine's child async context, so its asyncLocal null never flows back to the test. The shared State is deliberately left cleared and paused instead, which IsRecording reads correctly as not recording.

Start only checked for a non null state though, so the supported pattern

Recording.Start(); ... await Verify(x);
Recording.Start(); ... await Verify(y);

threw 'Recording already started', which was not true: the first recording had already been consumed.

The state now carries a Stopped flag, and Start replaces a stopped state while still rejecting a live one.

TryStop runs inside the engine's child async context, so its asyncLocal null
never flows back to the test. The shared State is deliberately left cleared and
paused instead, which IsRecording reads correctly as not recording.

Start only checked for a non null state though, so the supported pattern

    Recording.Start(); ... await Verify(x);
    Recording.Start(); ... await Verify(y);

threw 'Recording already started', which was not true: the first recording had
already been consumed.

The state now carries a Stopped flag, and Start replaces a stopped state while
still rejecting a live one.
@SimonCropp SimonCropp added this to the 33.0.0 milestone Aug 29, 2026
@SimonCropp
SimonCropp merged commit 56e4121 into main Aug 30, 2026
3 of 5 checks passed
@SimonCropp
SimonCropp deleted the fix-recording-restart branch August 30, 2026 02:13
@github-actions
github-actions Bot restored the fix-recording-restart branch August 30, 2026 02:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant