runtime icon indicating copy to clipboard operation
runtime copied to clipboard

Unix: System.IO.Pipes; Operations not throwing exceptions after Dispose

Open bpschoch opened this issue 11 years ago • 1 comments

[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  System.IO.Pipes.Tests.NamedPipesThrowsTests.ServerWhenDisplosedThrows [FAIL] 13:28:39  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  Stack Trace: 13:28:39  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.b__5a()

bpschoch avatar May 15 '15 22:05 bpschoch

Fixed by dotnet/corefx#1884

stephentoub avatar Jun 03 '15 03:06 stephentoub