The pipe tests were using NativeOverlapped which still doesn't have a
not-supported impl. Add a dummy implementation and don't try to
restore it for Unix.
Two other NetCore50 projects were restoring a lower version of S.R.E
that didn't contain an impl for NetCore50.
Commit migrated from https://github.com/dotnet/corefx/commit/0926ca688f4c935cd979f3d728d3b70f7c5072de
We removed the lifting from the lineup so tests should reference the
latest packages in order to ensure an implementation is available.
The latest pacakges exclude implementation dependencies so I needed to
add these to projects that were depending on them coming in transitively.
Commit migrated from https://github.com/dotnet/corefx/commit/bef9061fd1238adf47b864d8924d121e4134465b
The latest drop of packages no longer includes lifting entries in the
lineup. This causes errors when restoring for a concrete TFM and no
implementation assembly is in the packages.
I addressed this issue two ways:
1. In places where we were targeting a concrete TFM but packaging as
NETStandard, just target NETStandard instead.
2. In places where we were targeting a concrete TFM but that packages
were missing the implementation on that TFM, update the reference to
newer package version where implementation is available.
Commit migrated from https://github.com/dotnet/corefx/commit/dfb30176c6056f5b3427515c4444a9dc31b9ba4f
- Rather than hardcoding offsets and lengths related to the size of the native struct sockaddr_un's, get it from the native code. This will help with future platform support.
- With that info, allow the path to be as long as the platform will support, rather than capping it at a hardcoded value.
- Throw a meaningful exception when too long a length is specified.
Commit migrated from https://github.com/dotnet/corefx/commit/12b51c6bf153cc237b251a4e264d5e7c0ee84a33
PipeStream.In/OutBufferSize were both using Socket.ReceiveBufferSize. Not only could the in and out sizes be configured differently for a named pipe, for a one-directional pipe we shutdown the opposite direction of the socket when it's connected, and on OSX that results in that shutdown direction's buffer eventually (but not synchronously) becoming 0. This was leading to spurious failures in buffer size tests on OS X when trying to get the OutBufferSize of a PipeDirection.Out stream, as we'd shutdown the receive side.
This commit overrides InBufferSize and OutBufferSize on NamedPipe*Stream to return ReceiveBufferSize and SendBufferSize, respectively. This fixes the issue of returning the wrong buffer size if they happen to be different, avoids the OSX shutdown issue, and also avoids an issue where we'd end up trying to get the fcntl pipe size on the socket handle if the properties were used on an unconnected server stream.
Commit migrated from https://github.com/dotnet/corefx/commit/6fbf347269340380e24067e83628195a89b0b878
Today, NamedPipeServer/ClientStream are implemented on top of FIFOs, aka named pipes. There are some unfortunate limitations to this that are causing problems for typical usage of NamedPipeServer/ClientStream:
- FIFOs can be constructed as both read and write (i.e. InOut), but a writer can then immediately read what was written. In other words, whereas one might expect there two be two data channels, one in each direction, there's only one that everyone can read and write from.
- FIFOs can be connected to by any number of readers and writers, which has the effect of meaning a reader doesn't unblock when a writer disconnects, because there may be another writer in the future.
To address these significant limitations, this commit moves NamedPipeServer/ClientStream to be built instead on top of Unix domain sockets. Unix domain sockets are an IPC mechanism for local communication using the sockets model, and we have support for it via System.Net.Sockets.
Both of the aforementioned problems are addressed by this change. A few other positive outcomes:
- The participants on each side of the connection can get the credentials of the other side, so GetImpersonatedUserName is now implemented.
- Our Socket implementation has a good async implementation, so we can use it for all of the async operations exposed rather than queueing a work item that then blocks doing the synchronous operation.
There are a few downsides, but they're worth the tradeoff:
- FIFOs have the same general blocking behavior as anonymous pipes and as named pipes on Windows: a call to Write doesn't complete until an associated Read comes along. That's not the case with Unix domain sockets, where a Write typically just deposits the data into a buffer. Writes on a socket only block when the buffer is full.
- Unix domain sockets are considered to be a bit slower than FIFOs.
- Changing the buffer size of a FIFO impacts the whole FIFO, whereas changing the buffer size for a socket impacts just that end of the socket.
There continue to be several features that we don't support, e.g. message transmission, max number of servers, etc.
Commit migrated from https://github.com/dotnet/corefx/commit/fcc5cc9d78b84958394395611ebad9e7be222658
I'd initially created this thinking we'd have a bunch of different test suites for different scenarios, but it hasn't really panned out that way. In the meantime, having some tests for different projects not part of that project's test suite makes certain things more difficult, like dealing with changing dependencies, understanding code coverage, etc. I'm simply redistributing these tests to their propery homes and deleting the consolidated project.
Commit migrated from https://github.com/dotnet/corefx/commit/9baeb48d0027027eb75cc31b9ee52047d2f9f0e0
Most of the PlatformNotSupportedExceptions we throw in our Unix code paths are unconditional, e.g. in System.Console:
```C#
public static string Title
{
get { throw new PlatformNotSupportedException(); }
set { ... }
}
```
making it easy to understand without a customized message that the method being called isn't supported.
However, when there's more nuance, e.g. when the operation isn't supported because of a particular parameter value being used, we do want to use a message to clarify exactly what's not supported. Most such cases already have a custom message, but a few don't.
This commit fixes those that I could find that still need one (if we encounter more, we can add those on a case-by-case basis).
Commit migrated from https://github.com/dotnet/corefx/commit/1f9c90af9b91060558d2e4995d14202f4087cf7b
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