The documentation says that Connect can throw InvalidOperationException and ObjectDisposedException, but when you can't connect (remote server stopped, network problem, ...) a SocketException is thrown after a long timeout (about 10 seconds).
Worst, if you catch the exception and log the error another SocketException is thrown when you call Dispose. Documentation doesn't list any exceptions for Dispose.
Comments: Fixes in changeset 40626:
Fix exception documentation for BaseClient.Connect() and Session.Connect().
Added SftpPathNotFoundException to doc for SftpClient.Get(String) and SftpClient.GetAttributes(String).
Do not throw exception in Session.Disconnect() and Session.Dispose() when socket is not connected.
Worst, if you catch the exception and log the error another SocketException is thrown when you call Dispose. Documentation doesn't list any exceptions for Dispose.
Comments: Fixes in changeset 40626:
Fix exception documentation for BaseClient.Connect() and Session.Connect().
Added SftpPathNotFoundException to doc for SftpClient.Get(String) and SftpClient.GetAttributes(String).
Do not throw exception in Session.Disconnect() and Session.Dispose() when socket is not connected.