{"action":"created","issue":{"url":"https://api.github.com/repos/dotnet/corefx/issues/1884","labels_url":"https://api.github.com/repos/dotnet/corefx/issues/1884/labels{/name}","comments_url":"https://api.github.com/repos/dotnet/corefx/issues/1884/comments","events_url":"https://api.github.com/repos/dotnet/corefx/issues/1884/events","html_url":"https://github.com/dotnet/corefx/pull/1884","id":83587231,"number":1884,"title":"Fix System.IO.Pipes bugs (src and test)","user":{"login":"stephentoub","id":2642209,"avatar_url":"https://avatars.githubusercontent.com/u/2642209?v=3","gravatar_id":"","url":"https://api.github.com/users/stephentoub","html_url":"https://github.com/stephentoub","followers_url":"https://api.github.com/users/stephentoub/followers","following_url":"https://api.github.com/users/stephentoub/following{/other_user}","gists_url":"https://api.github.com/users/stephentoub/gists{/gist_id}","starred_url":"https://api.github.com/users/stephentoub/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stephentoub/subscriptions","organizations_url":"https://api.github.com/users/stephentoub/orgs","repos_url":"https://api.github.com/users/stephentoub/repos","events_url":"https://api.github.com/users/stephentoub/events{/privacy}","received_events_url":"https://api.github.com/users/stephentoub/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/dotnet/corefx/labels/2%20-%20In%20Progress","name":"2 - In Progress","color":"CCCCCC"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-06-01T16:22:57Z","updated_at":"2015-06-02T17:00:45Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/dotnet/corefx/pulls/1884","html_url":"https://github.com/dotnet/corefx/pull/1884","diff_url":"https://github.com/dotnet/corefx/pull/1884.diff","patch_url":"https://github.com/dotnet/corefx/pull/1884.patch"},"body":"Fix multiple test bugs in System.IO.Pipes.Tests and multiple product bugs in the Unix implementation of System.IO.Pipes, primarily around error cases surfacing an exception or the right exception and at the right time.\r\n\r\nProduct changes:\r\n- In the Windows implementation, avoids a few unnecessary allocations when registring for cancellation.\r\n- Common code shared between Windows and Unix is used to check the state of the streams prior to various operations, including validating the current state of the pipe's handle.  On Windows, the handle is always initialized at creation, whereas in the current Unix implementation, the handle's creation is deferred until the connection is established.  As such, code that checked the validity of the handle needed to be updated to not require that the handle be set on Unix.\r\n- The Unix NamedPipeServerStream.WaitForConnection implementation was missing a check to fail if the connection was already established.  On Windows, this is handled by the underlying OS function; on Unix, we just open a file, which any number of consumers can do, so there's no valdation provided by the OS for the constraint we need.\r\n- The Unix implementation of PipeStream was not overriding Read/WriteAsync, such that validation of the inputs was happening asynchronously.  I've refactored out the Read/WriteAsync validation logic to be shared between Windows and Unix, with the shared code overriding these methods.\r\n- In the Unix implementation, if any operation detects that the pipe has been broken, it needs to transition the pipe to a state of Broken.  The Windows implementation was already doing this.\r\n\r\nTest changes:\r\n- A bunch of calls to Assert.ThrowsAsync were ignoring the returned Task, which meant that a) any assertion failures were being ignored, b) operations may have continued to run well past the end of the test, and c) race conditions were occurring due to unexpected concurrency between operations.  These have been addressed by either awaiting on the resulting task (when the operation is expected to run asynchronously) or by changing to using Throw instead of ThrowAsync (when we expect the exception to propagate out synchronously).\r\n- Some tasks were being waited on synchronously, which could have potentially led to deadlock situations in the tests.  I changed everything relevant to use async/await.\r\n- The ServerCloneTests was failing (on both Windows and Unix) because it was closing the client stream prior to being done with the test.  I fixed up the disposal ordering and re-enabled the test. I also had to change the order in which operations occurred around waiting for the connection, due to the Unix implementation not establishing the handle until the connection is established, rather than during construction.\r\n- I added some Interop.IsWindows checks for functionality known to be unavailable on Unix, e.g. NumberOfServerInstances.\r\n- I changed a few tests to use In vs Out rather than InOut, to focus the test on what specifically was being tested, and because the Unix support for InOut isn't quite the same as on Windows.\r\n\r\nFixes #1762, #1763, #1764, #1765, #1766, #1772.\r\n\r\n(This commit also currently includes the changes in #1871; I will fix those appropriately once #1871 is merged.)"},"comment":{"url":"https://api.github.com/repos/dotnet/corefx/issues/comments/108015311","html_url":"https://github.com/dotnet/corefx/pull/1884#issuecomment-108015311","issue_url":"https://api.github.com/repos/dotnet/corefx/issues/1884","id":108015311,"user":{"login":"stephentoub","id":2642209,"avatar_url":"https://avatars.githubusercontent.com/u/2642209?v=3","gravatar_id":"","url":"https://api.github.com/users/stephentoub","html_url":"https://github.com/stephentoub","followers_url":"https://api.github.com/users/stephentoub/followers","following_url":"https://api.github.com/users/stephentoub/following{/other_user}","gists_url":"https://api.github.com/users/stephentoub/gists{/gist_id}","starred_url":"https://api.github.com/users/stephentoub/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stephentoub/subscriptions","organizations_url":"https://api.github.com/users/stephentoub/orgs","repos_url":"https://api.github.com/users/stephentoub/repos","events_url":"https://api.github.com/users/stephentoub/events{/privacy}","received_events_url":"https://api.github.com/users/stephentoub/received_events","type":"User","site_admin":false},"created_at":"2015-06-02T17:00:45Z","updated_at":"2015-06-02T17:00:45Z","body":"@dotnet-bot test this please"}}