We decided in the design meeting today that we should only be using ArrayPool in corefx itself in places where we can guarantee the types/methods won't cause corruption, even if due to misuse. Some of the usage we've already put in place doesn't meet this bar and needs to be removed. For example, we use ```ArrayPool<byte>.Shared``` in a special CopyToAsync implementation, but in doing so we hand a buffer from the pool out to the constiuent streams, and a poorly behaving stream could end up holding on to the buffer even after CopyToAsync has returned to the pool, such as if a Stream.WriteAsync implementation had a bug and completed the returned task before it was actually done with the buffer.
This commit removes all such usage (which we only very recently added).
Commit migrated from https://github.com/dotnet/corefx/commit/908c81d7a8c98f3f4dc1f6302ad7690a952c33c4
Correct instances of new "ArgumentException(nameof(..." so names are in the correct parameter. Where possible, I chose the resource string I felt best fit the situation. Otherwise, I created a new entry (I'm assuming there's some extra work that needs to be done there, but don't know what it is offhand).
Commit migrated from https://github.com/dotnet/corefx/commit/368fdfd86ee3a3bf1bca2a6c339ee590f3d6505d
Fixes https://github.com/dotnet/corefx/issues/5707
We are changing the .NET packages to no longer use the ‘dotnet’, ‘dotnet5.x’, and ‘dnxcore50’ monikers. This is thee first stage of the change for dotnet->netstandard.
The replacements are as follows
Old moniker | New moniker
----------------- | ------------------
dotnet5.x | netstandard1.y (where y = x -1)
DNXCore50 | netstandardapp1.5
dotnet | netstandard1.3
To prepare for this change you can do the following to your project.json. This change will require a recent build of NuGet or dotnet.exe and can be done prior to consuming the packages with the breaking change. These packages will not work with DNX.
For a project targeting dotnet5.6
```
"frameworks": {
"netstandard1.5": {
"imports": [ "dotnet5.6" ]
}
},
```
For a project targeting dnxcore50
```
"frameworks": {
"netstandardapp1.5": {
"imports": [ "dnxcore50", "portable-net45+win8" ]
}
},
```
[tfs-changeset: 1578321]
Commit migrated from https://github.com/dotnet/corefx/commit/4435f9f2776ae007e05f4454675e56cf76a51975
* Move all of the project configurations currently living in the
"facade\<lib>.csproj" files into the root library project. This means
there will now be only one project file for the source build of each
library, regardless of how many configurations it has. The .builds file
of each library will only reference that single project file multiple
times.
* Do some minor cleanup of project files along the way. Fix up the VS
default configuration blocks to be a bit more uniform. Remove redundant
defaults (OutputType, PlatformTarget, etc. Fix some condition spacing.
Commit migrated from https://github.com/dotnet/corefx/commit/26edfd6839044ca6368e28502e0893c1b1819b4c
These were missed by my automated scan in replacing parameter names with nameof because they're the wrong name. (There are some others that weren't replaced to, but most of those are because they're in private methods that use a different name for the argument, but the name used to the exception is the name in the publically exposed method... I didn't touch those.)
Commit migrated from https://github.com/dotnet/corefx/commit/95c0419f8cefb8e84eaecb4dacf08052312a5bb8
Put capitalization fixes back in place after some merge conflicts removed them. These fixes work around a xplat nuget restore race condition when there are multiple capitalizations of the same package ID in one restore command.
Commit migrated from https://github.com/dotnet/corefx/commit/b0660c5eee295fc011f9b755b06ec3bfb50f1f12
Adds a CopyFile function to the shim that, if possible, uses fcopyfile on OS X, sendfile on Linux, and elsewhere a manual read/write copy as we do today.
In my local tests on Linux, this often resulted in greater than 10% throughput improvements.
Commit migrated from https://github.com/dotnet/corefx/commit/fd13ac2f118673c709feb156efdea8782f0f625c
Some fixes (adding imports, adding Platforms package) were tooled, but more complex ones (forking project.jsons, editing csproj's) were not.
Also makes dependency version validation rules case-insensitive. (I used this fix to update the versions of some packages.)
[tfs-changeset: 1573868]
Commit migrated from https://github.com/dotnet/corefx/commit/84af04317505d48feaa1e83dd5dc27ddc0f6de76
The default CopyToAsync on Stream uses an 80K temporary buffer, making it a good candidate for buffer pooling. But Stream is in mscorlib and can't rely on System.Buffers. So this commit introduces an implementation that streams in mscorlib can use, just by overriding CopyToAsync and delegating. It then uses that in DeflateStream, GZipStream, FileStream, PipeStream, and UnmanagedMemoryStream.
Commit migrated from https://github.com/dotnet/corefx/commit/34ce38bc1517e8b7693223a9e41479dd24abc59a
When using async operations on FileStream, each operation ends up allocating several objects. By using a PreallocatedOverlapped, we can avoid the majority of those allocations, as well as avoid having to pin/unpin a buffer on each request.
This commit adds an optimization to FileStream that kicks in for the common case when:
- The buffer provided to ReadAsync/WriteAsync is smaller than the size of the FileStream's buffer, such that the FileStream's buffer is used. And when...
- Operations are not scheduled to run concurrently.
When those conditions are met, we use a PreallocatedOverlapped for the operation to avoid a ThreadPoolBoundHandleOverlapped, IOCompletionCallback, and _IOCompletionCallback getting allocated for each operation. This reduces the bytes allocated per operation by ~50% and the number of objects allocated by ~60%. It also saves having to pin/unpin the buffer on each operation.
When those conditions aren't met, we simply use the same code that's used today.
Commit migrated from https://github.com/dotnet/corefx/commit/c01617841be8b5087ed37f64bb2395afc722e549
A number of tests involving ReadOnly files were failing on Unix and Linux when run with elevated user permissions (e.g. sudo). This commit modifies those Unix tests to accomodate either set of permissions and verify the result accordingly. This unfortunately means we can't verify if the behavior is 'right', only that it is executed correctly. Windows is unchanged.
Commit migrated from https://github.com/dotnet/corefx/commit/77d73d27d06cf331c1637bc4e1cdc5aa35b68887
Windows.winmd was removed from M.TP.Private.NetNative targeting pack
so when some projects were bumped to a that version which needed
that reference they were broken. To fix we needed to explicitly add
a package dependency to M.TP.Private.WinRT package.
Commit migrated from https://github.com/dotnet/corefx/commit/674638364d94441854edf05c75e0e59a9c9a76ac
Previously on unix we would use stat to get information about directories and files for DirectoryInfo and FileInfo. That meant that we wouldn't correctly report ReparsePoint for symlinks, and the code was changed to use LStat. But that then breaks important use cases, such as by DirectoryInfo.Exist for a symlink to a directory always returning false.
This commit provides a compromise: we first use lstat, and if we find it's a symlink, we use stat but remember separately that it's a symlink so we can include ReparsePoint in the reported attributes.
Commit migrated from https://github.com/dotnet/corefx/commit/36259dc3c72fb1dc2a71a06db6f7dce9ea88c642