Skip to content

Simplify pack temp file usage - #7806

Merged
zivkan merged 1 commit into
devfrom
dev-zivkan-pack-scratch-usage
Oct 21, 2026
Merged

zivkan merged 1 commit into
devfrom
dev-zivkan-pack-scratch-usage

Conversation

@zivkan

@zivkan zivkan commented Oct 20, 2026

Copy link
Copy Markdown
Member

Bug

Fixes: refactor

Description

.NET's Path.GetTempFileName() creates a new file, ensuring it's not overwriting an existing file, whereas Path.GetRandomFileName() doesn't know what directory the file will be created in, and therefore doesn't know if it will already exist or not. The old code was using FileMode.Create, which would throw if it already exists. So, using Path.GetTempFileName() makes that error scenario impossible.

PR Checklist

  • Meaningful title, helpful description and a linked NuGet/Home issue
  • Added tests Since the temp files are used as local variables, tests can't know what path was used in order to validate that it no longer exists when the code under test returns.
  • Link to an issue or pull request to update docs if this PR changes settings, environment variables, new feature, etc. N/A

@zivkan
zivkan requested a review from a team as a code owner October 20, 2026 00:51
@zivkan
zivkan force-pushed the dev-zivkan-pack-scratch-usage branch from 7cc76ec to a3d3fc2 Compare October 20, 2026 23:42
@zivkan
zivkan merged commit 3b8e690 into dev Oct 21, 2026
18 checks passed
@zivkan
zivkan deleted the dev-zivkan-pack-scratch-usage branch October 21, 2026 02:51
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