This project is read-only.

Channel is closed error on Disconnect

Nov 5, 2014 at 8:20 AM
Hi,
I get the channel is closed error on calling disconnect on the SftpClient. Not sure what's happening.

Thanks.
Nov 5, 2014 at 10:44 AM
This is the stacktrace of the error

Unhandled Exception: System.NullReferenceException: Object reference not set to
an instance of an object.
at Renci.SshNet.Sftp.SftpSession.SendMessage(SftpMessage sftpMessage)
at Renci.SshNet.Sftp.SftpSession.SendRequest(SftpRequest request)
at Renci.SshNet.Sftp.SftpSession.RequestClose(Byte[] handle)
at Renci.SshNet.Sftp.SftpFileStream.Dispose(Boolean disposing)
at Renci.SshNet.Sftp.SftpFileStream.Finalize()
Coordinator
Nov 5, 2014 at 8:06 PM
One could consider this a bug in SSH.NET, but I'm inclined to say that you should close/dispose the SftpFileStream or StreamReader/StreamWrter that you obtained by invoking a method on SftpClient before disconnecting.

Can you review your code to make sure you're closing/disposing properly ?

Thanks!
Marked as answer by gan_s on 11/5/2014 at 7:13 PM
Nov 6, 2014 at 3:13 AM
Thanks a lot. There was a Streamreader open. Problem fixed now!