Repository navigation
Add Directory.CreateTempSubdirectory polyfill - #146
Conversation
Co-authored-by: Tyrrrz <1935960+Tyrrrz@users.noreply.github.com>
Co-authored-by: Tyrrrz <1935960+Tyrrrz@users.noreply.github.com>
|
@copilot merge in latest |
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Add separator validation and coverage for the invalid-prefix exception path.
Review effort: Lite
Findings: 1
Open (2)
What changed in this PR
Adds a .NET 7 Directory.CreateTempSubdirectory polyfill for older targets, with tests and generated documentation.
Changes:
- Implements temporary subdirectory creation with optional prefixes.
- Adds creation and prefix tests.
- Updates
Signatures.md. - Outstanding findings: missing separator validation (critical) and missing invalid-prefix test coverage (nit).
| File | Summary |
|---|---|
Signatures.md |
Documents the new API member. |
PolyShim/Net70/Directory.cs |
Implements the temporary-directory polyfill. |
PolyShim.Tests/Net70/DirectoryTests.cs |
Tests directory creation and prefixes. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
…-for-directory-createtempsubdirectory # Conflicts: # Signatures.md Co-authored-by: Tyrrrz <1935960+Tyrrrz@users.noreply.github.com>
Merged |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## prime #146 +/- ##
==========================================
- Coverage 87.77% 87.76% -0.02%
==========================================
Files 342 342
Lines 7443 7469 +26
Branches 539 542 +3
==========================================
+ Hits 6533 6555 +22
- Misses 742 745 +3
- Partials 168 169 +1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|


Directory.CreateTempSubdirectory(string?), introduced in .NET 7.0, had no polyfill for earlier targets (.NET Standard, .NET Framework, older .NET Core/5/6).Polyfill implementation
Directory.CreateTempSubdirectory(string?)toPolyShim/Net70/Directory.cs, alongside the existingCreateDirectory(string, UnixFileMode)member.prefixhas no directory separator characters, throwingArgumentExceptionotherwise.Path.GetTempPath(), optionally prefixed, retrying on name collisions.Tests
PolyShim.Tests/Net70/DirectoryTests.csfor default creation, prefixed creation, and the invalid-prefix exception path.Docs
Signatures.mdregenerated (via build) to list the new member.