Unix: System.IO.Pipes; Operations not throwing exceptions after Dispose
[Fact]
public static void ServerWhenDisplosedThrows()
{
using (NamedPipeServerStream server = new NamedPipeServerStream("unique2", PipeDirection.InOut))
{
server.Dispose();
Assert.Throws<ObjectDisposedException>(() => server.Disconnect()); // disconnect when disposed
Assert.Throws<ObjectDisposedException>(() => server.WaitForConnection()); // disconnect when disposed
Assert.Throws<ObjectDisposedException>(() => server.WriteByte(5));
Assert.Throws<ObjectDisposedException>(() => server.ReadByte());
Assert.Throws<ObjectDisposedException>(() => server.IsMessageComplete);
}
}
13:28:39 [31m System.IO.Pipes.Tests.NamedPipesThrowsTests.ServerWhenDisplosedThrows [FAIL]
13:28:39 [37m Assert.Throws() Failure
13:28:39 Expected: typeof(System.ObjectDisposedException)
13:28:39 Actual: typeof(System.InvalidOperationException): Pipe handle has not been set. Did your PipeStream implementation call InitializeHandle?
13:28:39 [30m Stack Trace:
13:28:39 [37m at System.IO.Pipes.NamedPipeServerStream.CheckDisconnectOperations()
13:28:39 at System.IO.Pipes.NamedPipeServerStream.Disconnect()
13:28:39 at System.IO.Pipes.Tests.NamedPipesThrowsTests.<>c__DisplayClass64.
Fixed by dotnet/corefx#1884