* replacing GetLastWin32Error with GetLastPInvokeError in remaining assemblies
* replace GetLastWin32Error with GetLastPInvokeError in assemblies outside system.private.corelib
* Apply suggestions from code review
Co-authored-by: Jan Kotas <[email protected]>
* Remove unused locals in System.IO.FileSystem.AccessControl
* Removed unused locals in System.IO.FileSystem.DriveInfo
* Remove unused locals and methods in System.IO.FileSystem
Mechanical/automated change. The only manual changes were a) removing the two rules from the CodeAnalysis.ruleset file, b) removing spaces from one line of a .targets file that is used to generate a .cs file, and c) reverting the changes in a few test files where the naive replacement happened in the middle of a verbatim string where the whitespace actually mattered.
Commit migrated from https://github.com/dotnet/corefx/commit/09a6e66b0c2b31bd0f6e7e3170537d14027aeed0
* Fix ordering of keywords in member signatures
* Add StyeCop.Analyzers
Most rules are disabled. Many of them we'll want to leave disabled, however there are a handful it'll be good to enable over time.
* Use built-in type alias
* Fix straggling stylecop warnings in all configurations
* Replace tabs with spaces
Commit migrated from https://github.com/dotnet/corefx/commit/a12c557a72988070b8624cc7ecc46899629895c4
* Nested directories were too deep
Nesting directories with Windows paths were over 800
levels deep, causing intermittent issues with stack overflows.
Making directory segments longer to mitigate.
* Use "N" format for guids per feedback
Commit migrated from https://github.com/dotnet/corefx/commit/27886bcb3d016a744e7461b3e378e7261230960f
* Removed preemptive checks for path being too long.
* Updated tests to catch proper exception.
Fixed an issue in IOInputs.cs where MaxLongPath was not being initialized correctly.
* Rework improper test change.
* Addresed some feedback and hopefully fixed failing unit tests.
* Go back to expecting PathTooLongException on all platforms for this test.
* Adjusted to handle either exception on non netfx.
Commit migrated from https://github.com/dotnet/corefx/commit/f2e440450e8b52317f08c21fe66f70141c9e933c
* Uri: detect Unix path on Unix, detect Dos&Unc path on Windows
* Update System.IO.Packaging/tests
* Update System.Xml.XmlSchema.XmlSchemaValidatorApi.Tests
* Update Common.Tests
* Update System.Private.Uri.Functional.Tests
* Update System.Private.Uri.ExtendedFunctional.Tests
* Update System.Runtime/tests
* Uri.MethodsTests.cs: comment out failing inputs
* Restore uri minimal length of 3
* Require unix paths to start with a /
* Allow Unix path file uri to start with '\'
* FileWebRequestTest: revert extra slashes added (file:/// back to file://)
* Uri: fix empty newHost bug and revert workaround in IriTest
* Annotate PlatformSpecific tests
* IdentityHelperTests: use file path that works on Windows and Linux
* System.IO.Packaging/tests: rename s_LocalFile to s_fullPathToLocalFile
* Uri: update comments on minimal Uri length check, don't check length twice on Windows
* Use PlatformDetection.IsWindows
* Ensure Roslyn gets rid of UnixPath checks on Windows by adding IsWindowsSystem (const bool) checks
* Uri: Fix uapaot build by including Uri.Windows.cs
* IdentityHelperTests: rename GetNormalizedUrlHash_Unix -> GetNormalizedUrlHash
* Uri.MethodsTests: don't require GetHashCode to return different values when Uris only differ in case
* s_IsWindowsSystem -> s_isWindowsSystem
* Detect Dos and Unc paths on Unix
* Update tests
* Clean-up
* Clean-up II
* Clean-up III
* Clean-up IV
* Clean-up V
* Move Flags.UnixPath to the end of the Flags enum
Commit migrated from https://github.com/dotnet/corefx/commit/7df6b74cc4aeebc86e76b5c7901a59fa7fa793f6
* Fix tests run on desktop
Conditionalize tests appropriately so long path and new syntax
support are taken into account.
Move some test data into Theories for easier debugging.
Fix and add issue to colon check tests until we fix CoreCLR.
* Address feedback
Commit migrated from https://github.com/dotnet/corefx/commit/551fe49174378adcbf785c0ab12fc69355cef6e8
- Add Common TempDirectory class for short-term temporary directories that are easy to create and destroy
- Put all FSW tests into the System.IO.Tests namespace
- Modify all FSW tests to use the common TempFile/TempDirectory classes instead of their own custom one
- Modify all FSW tests to watch for events in a temporary directory. There shouldn't be any more new items being created or watched in the runtime folder.
- Fix the SymLink tests to use the ConditionalFact attribute similar to how the FileSystem tests function.
- Remove the unnecessary symlink print statements being outputted by the FileSystem CreateSymbolicLink function.
Commit migrated from https://github.com/dotnet/corefx/commit/65356f9471850b796d01f63536c3ba36e504f8e1
We've visited this topic a few times... hopefully this is the last. We previously misunderstood some of how Windows handles symlinks, leading us to make some invalid choices on Unix. This addresses those issues.
For the most part with this commit, we now match Windows behavior on Unix wherever possible, while also trying to do something sensible on the Unix side. The only notable difference now comes into play for broken symlinks, due to a fundamental difference between symlinks on Windows and Unix: on Windows, a symlink is created as either a file or directory symlink and thus .NET can tell which it is even if it's broken... on Unix, a symlink only stores a path to its target, so when it's broken, there's no information about whether it's intended to be a file or a directory. As a result, we fall back to always treating it as a file.
Commit migrated from https://github.com/dotnet/corefx/commit/59da18fc926397f6674e1de86e296ca6e0dfe067
This change attempts to limit the number of allocations made when evaluating
full paths. This is particularly important when Windows paths can be way over
the historical max of 260 characters. (The new max is over 32K)
We no longer kick paths in Windows that are valid, outside of paths with colons
that are not directory separators. (This has the effect of blocking alternate
data stream access- which is a legacy behavior.)
When creating directories, we still drop the trailing separator, which causes
trailing whitespace to be trimmed. This makes it particularly difficult to create
paths with trailing spaces in .NET, which is still desirable as most code has
a tough time dealing with this scenario. We'll open them fine now, which hits
the above point of not kicking valid legacy paths (paths that don't require
extended syntax).
Several simplifications to the logic were made, including moving relative segment
evaluation to shared code and calling it directly when getting directory names
rather than relying on the not-so-obvious prior behavior of GetFullPath without
"full checks".
Commit migrated from https://github.com/dotnet/corefx/commit/11b457d1186c364bdf3e7d978006eb2417e8d060
One of the Extended Path FileSystem tests was leaving temporary test directories in the root folder of the running directory. This small change modified the tests to instead treat the user's temp directory as the root.
Commit migrated from https://github.com/dotnet/corefx/commit/bd2d87d7abcf092840e0929c6df1116665f90460
- References dotnet/corefx#2460. File.Move and FileInfo.MoveTo no longer always overwrite the destination file; added a non-concurrent validity check to MoveFile in the Unix implementation to serve as a temporary solution.
- Resolvesdotnet/corefx#2459. Reenabled Directory_CreateDirectory.DriveLetter_Unix as it's previous failures were not the fault of the method but of the system.
- Added test checks to work around the issue in dotnet/corefx#2537 until a final decision is reached for the desktop.
- Added Interop.Link to the Interop files for the (possible) implementation of File.Move
- Consolidated all of the related files that did nothing but inherit from other classes (e.g. File_GetFiles_str and File_GetFiles_str_str were consolidated into File_GetFiles)
- Removed the "partial" keyword from some test classes
- Finished overhauling all test cases that don't directly require solutions to Build System issues before being re-added (e.g. those that require networked drives or altering the current directory)
- Added some tests to increase code coverage slightly in some cases.
- All classes and files have been renamed to match the standard set by FileStream: only include parameters in the test/class name if there are overloads
- Modified the Unix behavior for distinguishing between a FileNotFoundException and a DirectoryNotFoundException to match that of Windows.
- Removed some redundant error checks that never catch
- DirectoryInfo.MoveTo(destPath) did not have checks for destinations with paths that are over MAXPATH. I added them to better match the behavior and error timing of Directory.Move(source, dest).
Commit migrated from https://github.com/dotnet/corefx/commit/481d5c645763da79145af50d123db3f4041aa05e
Additional work unblocking extended syntax. Fixes a few issues,
adds a number of tests, normalizes naming a bit more and moves/adds
helpers to shared code.
One nice side effect of this change is that you can now delete directories
that were undeletable before (if you had subdirectories that had trailing
spaces as one example).
Commit migrated from https://github.com/dotnet/corefx/commit/0721434e19e7f9ecf8bf6dba7485f6c86827388c
Start on unblocking extended syntax. Moves some shared code to PathInternal.
Start adding tests for key scenarios. Temporarily use local libraries when
testing FileSystem (until we get an updated Runtime.Extensions package).
Commit migrated from https://github.com/dotnet/corefx/commit/72429b2ba76ebecb4c422a1d5eec05daf279b05e
- Consolidated AccessTime, WriteTime, and CreationTime tests for FileInfo, File, DirectoryInfo, and Directory into one file per folder - GetSetTimes.cs
- Added some Unix tests
-Overhauled the Write/Read/Append tests for the File class and removed many duplicate tests
-Continuation of dotnet/corefx#2390
Commit migrated from https://github.com/dotnet/corefx/commit/5aebb5487de9fd481e3dd294c9d49aa25361dde2