Skip to content

SshClient.Dispose is throwing exception when SSH session gets disconnected unexpectedely #96

Closed
@mauroa

Description

@mauroa

The disposal of an SshClient instance could end throwing an exception when the SSH Session gets disconnected by the remote host.

A quick look into the code shows that even if the Dispose methods calls Disconnect internally and doesn't have exception handling (https://github.com/sshnet/SSH.NET/blob/develop/src/Renci.SshNet/BaseClient.cs#L339) , there is always a null check over the SshSession (https://github.com/sshnet/SSH.NET/blob/develop/src/Renci.SshNet/BaseClient.cs#L225-L246) to prevent any unwanted NullReferenceException. However, something is still going on when the session is remotely disconnected and the SshClient is tried to be disposed after that.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions