public override async Task <IDuplexPipe> ConnectAsync(CancellationToken cancellationToken) { var stream = new NamedPipeClientStream(".", _pipeName, PipeDirection.InOut, System.IO.Pipes.PipeOptions.Asynchronous); // We connect with a timeout of 0 because if the server isn't available we want to immediately cancel. stream.Connect(timeout: 0); return(stream.CreatePipe()); }