Skip to content

Await the voice details load before deleting the temp folder in a VoiceManager test - #16827

Merged
niksedk merged 2 commits into
SubtitleEdit:mainfrom
k6G52m4Dz75W:fix/voice-manager-detailsloaded-race
Nov 11, 2026
Merged

niksedk merged 2 commits into
SubtitleEdit:mainfrom
k6G52m4Dz75W:fix/voice-manager-detailsloaded-race

Conversation

@k6G52m4Dz75W

Copy link
Copy Markdown
Contributor

Follow-up to #16808: this surfaced during the full-suite runs while verifying that PR.

VoiceManagerViewModelTests.FilterNarrowsTheListAndKeepsTheSelectionWhenItStillMatches fails
intermittently with System.IO.IOException: Bob.wav is being used by another process in its
finally Directory.Delete(folder, true).

Selecting the file voice "Bob" starts an async details load whose peak generation
(WavePeakGenerator2) holds the wav open; the delete races that read. It reproduces
deterministically in isolated cold runs (10/10 failures) and passes in a warm full suite, which is
why it has only surfaced sporadically.

Fix: await vm.DetailsLoaded; immediately after the selection, before any filter changes. That
guarantees the stream is disposed before the temp folder is deleted. Placement matters: the later
filter resets re-select either null or the preset voice, both of which return before touching a
file, so the selection's load is the only one that holds a handle - an await at the end of the test
would wait on the wrong task. No production code changes; the async details load is intended
behavior.

Verification: isolated runs 10/10 failures before, 10/10 passes after; full test class green.

k6G52m4Dz75W and others added 2 commits November 11, 2026 10:32
…the filter

Clearing the filter re-selects the first row; today that is the preset,
but if the fake engine ever lists a wav first its peak load would race the
temp folder delete again.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@niksedk
niksedk merged commit 69662bb into SubtitleEdit:main Nov 11, 2026
4 checks passed
@niksedk niksedk mentioned this pull request Nov 11, 2026
@k6G52m4Dz75W
k6G52m4Dz75W deleted the fix/voice-manager-detailsloaded-race branch November 11, 2026 07:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants