* FileStream.Unix: improve DeleteOnClose when FileShare.None.
Use FileShare.None lock to detect when another Handle that has
DeleteOnClose deleted the file, and then re-open it.
* Rephrase comment
* FileStream_DeleteOnClose: handle a few special cases.
* Try avoiding test timeout on arm
* Limit check to filemodes that open an existing file, or create it when it doesn't exist.
* PR feedback
* Limit functional change to FileMode.OpenOrCreate, and increase test timeout.
* Fix comment.
Co-authored-by: Carlos Sanchez <[email protected]>
Co-authored-by: Carlos Sanchez <[email protected]>
* File preallocationSize: align Windows and Unix behavior.
This aligns Windows and Unix behavior of preallocationSize for the
intended use-case of specifing the size of a file that will be written.
For this use-case, the expected FileAccess is Write, and the file should be
a new one (FileMode.Create*) or a truncated file (FileMode.Truncate).
Specifing a preallocationSize for other modes, or non-writable files throws ArgumentException.
The opened file will have a length of zero, and is ready to be written to by the user.
If the requested size cannot be allocated, an IOException is thrown.
When the OS/filesystem does not support pre-allocating, preallocationSize is ignored.
* fix pal_io preprocessor checks
* pal_io more fixes
* ctor_options_as.Windows.cs: fix compilation
* Update tests
* tests: use preallocationSize from all public APIs
* pal_io: add back FreeBSD, fix OSX
* tests: check allocated is zero when preallocation is not supported.
* Only throw for not enough space errors
* Fix compilation
* Add some more tests
* Fix ExtendedPathsAreSupported test
* Apply suggestions from code review
Co-authored-by: David Cantú <[email protected]>
* Update System.Private.CoreLib Strings.resx
* PR feedback
* Remove GetPathToNonExistingFile
* Fix compilation
* Skip checking allocated size on mobile platforms.
Co-authored-by: David Cantú <[email protected]>
* NT prefix shall not be treated as a relative path
* Remove file-folder-match validation
* Use SubstituteName instead of PrintName since the latter is just for display and can be misleading
* Fix MS.IO.Redist
* Fix whitespace in Strings.resx
* Address suggestions
With the newest udpate of slngen, the order of elements (configuration, folders, etc.) is in sync with how Visual Studio arranges them.
Also the order is now deterministic.
Based on that, updating all solution files to have the correct ordering of elements. This change also unblocks adding CI protection for
making sure that solution files are up-to-date in regards to their dependencies as slngen is now generating the files deterministically.
* Add mount point support to link APIs.
* Add junction and virtual drive tests.
* Move PrintName comment outside of if else of reparseTag check.
* Add Windows platform specific attribute to junction and virtual drive test classes.
* Revert FILE_NAME_OPENED to FILE_NAME_NORMALIZED
* Revert addition of FILE_NAME_OPENED const.
* Remove unnecessary enumeration junction test.
* Rename GetNewCwdPath to ChangeCurrentDirectory
* Make Junction_ResolveLinkTarget a theory and test both resolveFinalTarget
* Shorter name for targetPath string. Typo in comment. Fix Debug.Assert.
* Clarify test comment. Change PlatformDetection for OperatingSystem check.
* Cleaner unit tests for virtual drive, add indirection test
* Skip virtual drive tests in Windows Nano (subst not available). Small test rename.
* Simplify Junctions tests, add indirection test
* Address test suggestions.
* Revert MountHelper.CreateSymbolicLink changes. Unrelated, and will be refactored/removed in the future.
Detect if SUBST is available in Windows machine, to bring back Nano.
* Add dwReserved0 check for mount points in GetFinalLinkTarget.
* Use Yoda we don't.
* Fix CI issues
Co-authored-by: carlossanlop <[email protected]>
Co-authored-by: David Cantu <[email protected]>
* Remove validation to stat call for symlinks since is a breaking change, subsequently remove the symlink cache logic as is no longer needed
* Undo try-catch workaround in PhysicalFileProvider
* Fix tests that were failing due to changes
All this changes are to internal methods which are later called by other public methods which correctly call `ToLocalTime` for local time "overloads".
Performance hit is most visible for application which doesn't need to load local timezone information which takes ~30ms on 2016 MacBook Pro.
Co-authored-by: Jeff Handley <[email protected]>
* move CanRead and CanWrite checks to FileStream
* don't check IsClosed twice_(FileHandle.CanSeek already contains a IsClosed check)
* add a failing test
* handle incomplete async reads
* don't try to cache file length when file is opened for writing, as updating file position before performing async write can lead to invalid cached length value
* maybe Win 7 & 8 fix
* Make Named Pipe Server Stream name fit into allowed length on Android
* Apply Stephen's suggestion
* Remove redundant parameter
* Take into account possible null terminator
* File.Unix: Replace: increase Windows compatibility
- When source and destination are not a file throw UnauthorizedAccessException.
- When source and destination are the same file throw IOException.
* Include paths in exception message
Co-authored-by: Jeff Handley <[email protected]>
* add test project with file locking disabled via config file
* use O_TRUNC when file locking is disabled, avoid ftruncate syscall
* Apply suggestions from code review
Co-authored-by: Stephen Toub <[email protected]>
* Handle FileOptions.DeleteOnClose on Unix in SafeFileHandle.Dispose
* Move file path into SafeFileHandle on Windows as well
Doing so enables cleaning up a bunch of passing around of the file path, while also enabling the path to be fed to more error paths.
* Update Net5Compat impl as well
* add more tests
* StreamWriter and StreamReader require FileStreamOptions with necessary access
* allow for bufferSize == 0
* extend the test
* refactor the tests
* Revert "allow for bufferSize == 0"
This reverts commit f1259be18a3446c1b8939883f484cc28347c74cf.
* add a test for unseekable device by using a path to named pipe
* add a test for seekable device by using DeviceID instead of drive letter
* add a test for a UNC file path (local file share)
* Return constants in PathInternal.GetIsCaseSensitive() on mobile platforms
In particular on Android probing using I/O is slow and contributes to slow app startup.
Fixes https://github.com/dotnet/runtime/issues/54339
* Implement Path.IsCaseSensitive as PathInternal.IsCaseSensitive
Also Path.StringComparison => PathInternal.StringComparison
* Add test for PathInternal.IsCaseSensitive
Move GetIsCaseSensitiveByProbing to FileSystemTest
* Drop PathInternal.s_isCaseSensitive cache field
* Delete Path.IsCaseSensitive and Path.StringComparison
update callers to use PathInternal.IsCaseSensitive and PathInternal.StringComparison
* Remove catch clause from GetIsCaseSensitiveByProbing
* Mark new test [OuterLoop]
* Apply suggestions from code review
Co-authored-by: Stephen Toub <[email protected]>
Co-authored-by: Jan Kotas <[email protected]>
Co-authored-by: Adam Sitnik <[email protected]>
Co-authored-by: Stephen Toub <[email protected]>