The problem comes from the StreamWriter() you use.
Use writer.Write(cmd + "\n") or use the WriteLine of the ShellStream.
I suggest you remove your StreamWriter() and StreamReader() and use the methods included in SshShellStream instead.
Use writer.Write(cmd + "\n") or use the WriteLine of the ShellStream.
I suggest you remove your StreamWriter() and StreamReader() and use the methods included in SshShellStream instead.