* Fix test build break and update common path usages to use property
* Use normalize directory for CommonPath and CommonTestPath
* Update instances of CommonPath and CommonTestPath to not use trailing \
* Use Strings.resx file for the exception messages within System.Windows.Extensions
* Use Strings resx file for the exception messages within System.Threading
* Use Strings resx file for the exception messages within System.Security.Cryptography.Xml
* Use Strings resx file for the exception messages within System.Runtime.WindowsRuntime
* Use Strings resx file for the exception messages within System.Reflection.Metadata
* Use Strings resx file for the exception messages within System.Private.Xml
* Use Strings resx file for the exception messages within System.Private.DataContractSerialization
* Use Strings resx file for the exception messages within System.Numerics.Tensors
* Use Strings resx file for the exception messages within System.IO.Packaging
* Use Strings resx file for the exception messages within System.IO.FileSystem
* Use Strings resx file for the exception messages within System.Drawing.Common
* Use Strings resx file for the exception messages within System.DirectoryServices
* Use Strings resx file for the exception messages within System.Diagnostics.DiagnosticSource
* Use Strings resx file for the exception messages within System.Composition.Hosting
* Update ExportDescriptorPromise.cs
* Fix build
Commit migrated from https://github.com/dotnet/corefx/commit/1518fdc5cc94571bf3ce1bb95e1a60f789a67f18
* Fix to support case-insensitive directory moving/renaming
* More tests for other directories
* Include throwing win32 exp upon directory already existing
* Added ) that I dropped in previous rebase
* Directory get with pattern to check for case sensitivity
* Error message fix
* Rework to support multiple edge cases
* Rework to only support moving to the same directory case insentivity
* Handle situations for case-sensitive file systems
* Test changes
* Stopped modifying environment's current directory
* Cleanup, and tests for drive differences
* Only set route to lower, but only only compare roots ordinally
* Add additional if to check if any directory with that name exists
* Edit to what path to use
* Use destination path.
* Rework file directory scan
* Make utility function due to Any() with empty returning true
* Get the full path before getting the filename
* Check if the directory name is null or empty
* Removed extra line
* Now Defering to the OS for if the directory already exists
* Remove extra semi-colon
* Test Edit
* Comment edit
* Actually test the functionality the test is built for
* Remove platform specific tests and make them platform agnostic
* Target only OSX
* Target all platforms other than linux itself
* Changed how we detect case variants
* Remove unix specific test
* Convert OSX test into no-op test
* Code review feedback and additional tests
* Case-Sensitive file systems specific tests
* Fix to not include osx with other unixes
* Removed a ,
Commit migrated from https://github.com/dotnet/corefx/commit/e9ce2f734698ab5bf13f947c281fa4bec67b0216
* Rework SystemNative_CopyFile to use paths instead of file descriptors
Use clonefile for CopyFile, if available
* Bail out in SystemNative_CopyFile if access fails. We don't want to proceed if the destination file is read-only.
* Handle a race condition where clonefile can result in EEXIST error
* Update comment about fcopyfile
* Update PathInternal.TrimEndingDirectorySeparator to Path.TrimEndingDirectorySeparator
* Add missing close(outFd) call
* Remove unnecessary ! operator
* Save errno around close(outFd) calls
* access already sets EACCESS errno, just keep it
* Remove fcopyfile support
* Open destination file with O_CLOEXEC
* Return correct error code for source == destination
* Rearrange error handling a bit
* Remove forgotten HAVE_FCOPYFILE
Commit migrated from https://github.com/dotnet/corefx/commit/5f45a8d5aa116d688f92952a1de72abd8b30f1a7
Approved API Proposal: dotnet/corefx#41614
Related change for directory creation method that takes an ACL: dotnet/corefx#41834 -merged and ported to 3.1 Prev2
Description
We have extension methods in System.IO.FileSystem.AclExtensions that let the user get and set ACLs for existing files, but we do not have methods that create files with predefined ACLs.
.NET ACL (Access Control List) support is Windows specific. This change will reside inside the System.IO.FileSystem.AccessControl assembly.
Customer impact
Before this change, customers had to create a file or filestream, then set its ACLs. This presents a few problems:
Potential security hole as files can be accessed between creation and modification.
Porting difficulties as there isn't a 1-1 API replacement
Stability issues with background processes (file filters) can prevent modifying ACLs right after creation (typically surfaces as a security exception).
This change addresses those problems by adding a new extension method that allows creating a file and ensuring the provided ACLs are set during creation.
This change is expected to be backported to 3.1.
Commit migrated from https://github.com/dotnet/corefx/commit/508cbc4f1021e260b52981b8510cc5a5881441d3
* First commit
* Fix OperationCanceledException dependency error, revert nullable indication
* Only Directory files
* Unit tests verifications
* Split FileSystem.Windows into two additional files instead of one. Fix pinning.
* Remove dead comment, add actual UT verifications
* User WellKnownSidType
* Make method unsafe, nit comments addressed.
* Remove irrelevant comment
* Add additional exceptions to triple slash
* Add unit tests for additional exceptions
* Remove FileSystem.cs, it has one obsolete method. Replace all calls of that removed method.
* Second pass on required strings.resx resources
* Remove unused dependency cs files
* Move shared files to Common
* Add the missing braces
* Add nulcheck for this argument, add exception, document exception in triple slash, add unit test.
* Fix netstandard CI build failure
* Fix Microsoft.IO.Redist build issue with NetStandard
* Remove unnecessary assert in ut
* Fix build problem in Windows Packaging All Configurations x64_Debug, System.Runtime needs to be included to recognize NotNullIfNotNullAttribute, consumed in Path.Internal.cs
* Additional file splitting and dependency addition to fix netstandard/netfx build problems
* Fix netstandard and netcoreapp build issues
* Remove unused file
* nit cleaning
* Minimal unit tests
* Remove unused unit test code and spacing fix
* Add full framework condition to unit test
* Additional fix for full framework
Commit migrated from https://github.com/dotnet/corefx/commit/5ed2e98718700ba37ed95c34ee04960b5aba1aa0
Many of our RemoteInvokes are there purely because of needing to change the current thread culture but on UAP that actually impacting the whole process. Until that's addressed, we can at least avoid the RemoteInvoke on all platforms other than UAP. There are also some RemoteInvokes that can be avoided by just serializing all of the (small number of) tests in a test assembly. And there's some additional cleanup to be done as well around not explicitly returning an exit code unless required.
This helps measurably with test performance. Consider the System.ComponentModel.Annotations test suite. On my machine, prior to these changes, it took ~25 seconds; after these changes, it takes ~0.3. It helps even more when running against a checked runtime, where all of our test costs are magnified. With a checked runtime, prior to these changes, it takes ~196 seconds; after these changes, it takes ~2.5 seconds. This should help measurably with CI time in coreclr.
Commit migrated from https://github.com/dotnet/corefx/commit/cd18bafbabf7fe47601f6f790d157409034a2477
* FileSystem.Unix.File.Move use rename in more cases, avoid link/copy when possible, improve performance on file systems that do not support hard links, such as FAT
* Adapt Unit Tests for accounting FileSystemWatcher events fired by FileSystem.Unix.File.Move implementation that use rename in more cases, avoiding link/copy when possible
Commit migrated from https://github.com/dotnet/corefx/commit/89b087ba5548338bb604db4e1cca0e42f8273e2b
However, I'm not enabling the rule permanently, as it disagrees with VS IDE0055 about the spacing around semicolons at the end of empty while and for loops.
Because this also impacts `for (;;)` loops, I also searched and replaced those with `while (true)`, to standardize on that across the codebase.
Commit migrated from https://github.com/dotnet/corefx/commit/93285e4511a9656a30b92b8b6a9088608aac40e0
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
* Re-enable xunit warning 1026 (unused theory arguments)
Some of these were addressed by explicitly discarding theory arguments, generally in cases where either a) the argument was being used as a description to aid in debugging failures, or b) the argument was part of a member data that was used by some theories and not by others all sharing the same member data.
However, there are quite a few legitimate bugs being fixed here, enough that highlights it's worthwhile to have the rule enabled. Some are cases where the argument was supposed to be used but wasn't. Some are cases where the argument isn't used at all, and in many cases where we end up running the same test over and over and wasting cycles. Some are cases where we're unnecessarily including irrelevant inputs to the tests and making the input data more complicated than it needs to be. Etc.
(Along the way, I also fixed some cases where VS was warning about lambdas being used instead of local functions, and in cases where I agreed I fixed them, via auto-fixers.)
* Address PR feedback
Commit migrated from https://github.com/dotnet/corefx/commit/daf93ee0e5e5233141eb762c64b6049cfd7d123e
* 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
* Replace "Assert.Equal(true, " with "Assert.True("
* Replace "Assert.Equal(false, " with "Assert.False("
And fix a few Assert.Equal(true cases that deal with objects and thus need to be reverted.
* Replace "Assert.StrictEqual(true, " with "Assert.True("
* Revert a few changes where true/false was being compared to object
* Address PR feedback
Commit migrated from https://github.com/dotnet/corefx/commit/1296bc8386a7283e319ddf723282f16651f9ea5f
Issue
In Windows, when iterating over the files of a directory whose name ends in a dot, the iteration fails by throwing an unexpected exception, even when using the proper prefix "\\?\" for the full directory path.
Fix
Add a new boolean argument at the end of the enumeration function signatures that will indicate if the passed path is normalized or not. If it is normalized (which only happens when the path is created by us, not by the user), then we can create the handle using that path. If it's not normalized, we attempt to get its full path before creating the handle, which will throw if a full path can't be obtained.
Added a new unit test to verify the fixed behavior and updated some others whose behavior changed with this fix.
Commit migrated from https://github.com/dotnet/corefx/commit/8e95261ef710e0df980a6d46923eb3c0e8b0bc83
Assert.Equals on arrays boxes each element and then performs a complex
operation to compare each box. This is slow for large arrays, and extremely
slow for large arrays on checked CoreCLR.
Use AssertExtensions.Equal for large arrays in File.Copy tests to make
them reasonably fast on checked CoreCLR.
Commit migrated from https://github.com/dotnet/corefx/commit/c53300f0696c4817bc06a8ef8711a0bb46f362ec
* Factor out repo restore into seperate props/targets
* Use configuration system msbuild sdk
* Remove XUnit.Runtime.depproj
* Remove TargetGroup usages in test projects
* Fix ILLink configuration
The ILLink package contains netcoreapp2.0 assets which are compatible
with netstandard2.0. Removing the old TargetFramework to restore
successfully.
* Remove usages from TargetGroup in Directory.Build.props
* Remove dead net4* configurations
* Change tests.builds to tests.proj sdk proj
* Make externals dir proj an sdk project
* Consume Microsoft.DotNet.CoreFxTesting as an msbuild sdk
* Use runtimeconfig.template.json
* Remove SupplementalTestData
* Map shared framework version to product version
* Stop binplacing tests
* Move some tool depprojs to targets during restore
* Remove dead code
* Use PackageReference instead of RefFromRuntime in test
* Disable using an apphost
* Copy compression testdata manually cause unicode bug
* Remove target batching in optimizationData
* Reference packaging tools from CoreFx.Private.TestUtilities
Commit migrated from https://github.com/dotnet/corefx/commit/c4c1985531cc1f25c805bbc4801b85c98e0dfee0
In the 1903 release of Windows 10 the deletion behavior has changed. Previously, the filename would be reserved until all open handles were closed after being marked for deletion. Now the filename is immediately released.
Commit migrated from https://github.com/dotnet/corefx/commit/a4cf9a480b34a00e11201e932f7152c63b99b85f
System.IO.Filesystem's MoveFile() and ReplaceFile() use the link() syscall under some conditions to avoid a copy. This fixes two problems with that:
* MoveFile()'s fall-back does not recognize a possible Android error as non-critical, and bails out on the fall-back with an exception. From logs we know that 'strerror_r(android_error)' = 'Permission denied' so the Android error should be EACCES (we already check for EPERM)
* While MoveFile() was using a fall-back, ReplaceFile() wasn't.
Commit migrated from https://github.com/dotnet/corefx/commit/f6aed7b177580ed3953e6e23dccbe2de57850729