Skip to content

Release named recording state on dispose - #1898

Merged
SimonCropp merged 1 commit into
mainfrom
fix-named-recording-dispose
Aug 29, 2026
Merged

Release named recording state on dispose#1898
SimonCropp merged 1 commit into
mainfrom
fix-named-recording-dispose

Conversation

@SimonCropp

Copy link
Copy Markdown
Member

The named disposable only paused, so a scope left without an explicit Stop, for example because the test threw, left the State and every object it had recorded reachable forever through the static namedState dictionary. The unnamed variant is reclaimed with its execution context, but named state has nothing to reclaim it.

It also blocked the identifier: identifiers are documented as statically unique, such as a fully qualified test name, so the next Start with the same one threw 'Recording already started', masking the original failure.

Dispose now removes the entry, which stays a no-op after an explicit Stop.

The named disposable only paused, so a scope left without an explicit Stop, for
example because the test threw, left the State and every object it had recorded
reachable forever through the static namedState dictionary. The unnamed variant
is reclaimed with its execution context, but named state has nothing to reclaim
it.

It also blocked the identifier: identifiers are documented as statically unique,
such as a fully qualified test name, so the next Start with the same one threw
'Recording already started', masking the original failure.

Dispose now removes the entry, which stays a no-op after an explicit Stop.
@SimonCropp SimonCropp added this to the 33.0.0 milestone Aug 29, 2026
@SimonCropp
SimonCropp merged commit ff42d46 into main Aug 29, 2026
6 of 7 checks passed
@SimonCropp
SimonCropp deleted the fix-named-recording-dispose branch August 29, 2026 10:42
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