Skip to content

feat: update to .NET 10 and support deleting reserved device name files (NUL)#47

Open
domsleee wants to merge 1 commit intomainfrom
net10-and-nul-deletion
Open

feat: update to .NET 10 and support deleting reserved device name files (NUL)#47
domsleee wants to merge 1 commit intomainfrom
net10-and-nul-deletion

Conversation

@domsleee
Copy link
Copy Markdown
Owner

@domsleee domsleee commented Mar 30, 2026

Changes

.NET 10 upgrade

  • Update TargetFramework from net9.0 to net10.0
  • Update global.json SDK from 9.0.200 to 10.0.100
  • Update all CI workflows (ci.yaml, release.yaml, benchmark.yaml) to dotnet 10.0.x
  • Update AOT publish path in release workflow

Reserved device name file deletion (NUL, CON, PRN, etc.)

On Windows, files named nul, con, prn, etc. are reserved device names that can't be deleted with standard APIs. These files can be created by cross-platform tools (e.g. git cloning a repo from Linux).

This PR adds support for deleting them using the \\?\ extended-length path prefix:

  • Detect reserved device names via regex in DirectoryUtils.IsReservedDeviceName
  • Use \\?\ prefix for File.Exists and File.Delete on reserved names
  • Handle Path.GetFullPath resolving reserved names to \\.\ by resolving the parent directory separately
  • Works for both direct deletion (DeleteFileOrDirectory) and recursive directory deletion (DeleteFilesInFolder)

Reference: https://gist.github.com/domsleee/c0e01497faa89667dc989630cab21945

Version bump

  • 1.5.11.6.0

Tests

  • DeletingFileWithReservedDeviceName — creates a nul file and deletes it directly
  • DeletingDirectoryContainingFileWithReservedDeviceName — deletes a directory containing a nul file
  • Both tests verified to fail without the fix and pass with it

…ce names (NUL, CON, etc.)

- Update TargetFramework to net10.0 and SDK to 10.0.100
- Update all CI workflows to use dotnet 10.0.x
- Add detection and deletion of Windows reserved device name files using \\?\ prefix
- Handle Path.GetFullPath resolving reserved names to \\.\NUL by resolving parent dir separately
- Add tests for deleting NUL files directly and within directories
- Bump version to 1.6.0

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.

1 participant