Fix HTML logger parallel file collision with atomic file creation by nohwnd · Pull Request #15562 · microsoft/vstest (original) (raw)
AI review requested due to automatic review settings
Copilot AI review requested due to automatic review settings
Replace lock-based file creation with atomic FileMode.CreateNew to prevent cross-process race conditions when multiple test processes generate HTML log files simultaneously.
Changes:
- Use FileMode.CreateNew instead of lock + File.Exists check in GenerateUniqueFilePath, making file creation atomic across processes
- Add fractional seconds (fffffff) to timestamp format for better cross-process uniqueness in both FormatDateTimeForRunName and the LogFilePrefix path
- Remove static FileCreateLockObject that only protected within a single process
- Add test verifying fractional-seconds timestamp in generated filenames
Fixes microsoft#15404
Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com
nohwnd added the 🚢 Ship it!
Add to PRs where owner approves automated PR, but cannot approve because they "wrote it".
label
This was referenced
Mar 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
[ Show hidden characters]({{ revealButtonHref }})