New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Offer Posix-style file and directory deletion APIs #32737
Comments
cc: @JeremyKuhne, who's looked at this in detail. |
The Posix style deletion is the default now, we have tests that validate that. There might be edge cases here and I believe there was an intent to provide a compat switch, but I'm not sure where that lives- I'll see if I can find more details. We should consider adding the ability to disable the new behavior, but I suspect that need is fairly narrow. cc: @carlossanlop |
Triage: Closing as Posix style deletion is the default now in Windows 10 (as of 1903). |
Note:
Starting with Windows 10 version |
It seems that recent versions of Windows offer the ability to immediately delete "POSIX style": https://docs.microsoft.com/en-us/windows-hardware/drivers/ddi/ntddk/ns-ntddk-_file_disposition_information_ex
This means that file deletion is fully synchronous. The name for the file is deleted while open handles can still exist.
Asynchronous file deletion on Windows is a fairly common pain-point, for example: PowerShell/PowerShell#8211 (related: #27958).
The MSVC STL implementation uses synchronous deletion if available: https://github.com/BillyONeal/STL/blob/ece92443331ad03eb70ee1824dad87165b410e97/stl/src/filesystem.cpp#L655
There is a fallback for situations in which this deletion style is not supported. According to microsoft/STL#407 it seems that ReFS does not support this.
Here is a discussion of a case where this feature was used to delete something that otherwise could not be deleted at all: https://community.osr.com/discussion/286551
This seems like a useful feature to have. .NET should offer an API for this. This could take the form of a new enum:
This enum could hold further features such as the commonly requested ability to delete readonly files or the ability to ignore the situation where the target does not exist.
The text was updated successfully, but these errors were encountered: