+1 vote
by (210 points)

There is a NullReferenceException when you check SshSession.IsConnected property before you call a Connect method for the first time.

        try {
            SshSession session = new SshSession();
            Console.WriteLine("IsConnected: {0}", session.IsConnected);
        catch (NullReferenceException ex) {
            Console.WriteLine("Found a BUG!");

1 Answer

0 votes
by (143k points)
edited by
Best answer


The fix has now been released as part of version 2015R4 of Rebex components.

This is indeed a bug - thanks for bringing it to our attention!

We will fix this in the next release. In the meantime, please use the following workaround:

SshSession session = new SshSession();
bool isConnected = (session.Socket != null) ? session.IsConnected : false;
Console.WriteLine("IsConnected: {0}", isConnected);