Hi, anytime I try to close forwarded port it ends with exception.
I'm using SSH.NET.2013.4.7 when switched to 2014.4.6b2 I got "A first chance exception of type 'System.ObjectDisposedException' occurred in System.dll" instead, exactly in the same place.
here is sample class that replicates this error:
```
public class ExampleSSH
{
public static ConnectionInfo TunnelConfiguration { private get; set; }
public static ForwardedPortLocal ForwardedPort { get; private set; }
private static SshClient _currentTunnel;
public static SshClient CurrentTunnel
{
get
{
//establish connection if none
if (_currentTunnel == null)
{
_currentTunnel = new SshClient(TunnelConfiguration)
{
KeepAliveInterval = TimeSpan.FromMinutes(5)
};
//_currentTunnel.ErrorOccurred += (sender, args) => Log.Error(args.Exception);
//_currentTunnel.HostKeyReceived += (sender, args) => SSH.HandShake(args);
}
//connect if disconnected
if (_currentTunnel.IsConnected == false)
{
_currentTunnel.Connect();
//var currentShell = _currentTunnel.CreateShellStream("terminal", 80, 24, 800, 600, 1024);
//{
// currentShell.DataReceived += CurrentShellOnDataReceived;
//}
}
//forward ports if missing
if (!_currentTunnel.ForwardedPorts.Any())
{
ForwardedPort = new ForwardedPortLocal("localhost", Network.GetAvailablePort(DB.CurrentState), "localhost", 3306);
_currentTunnel.AddForwardedPort(ForwardedPort);
//ForwardedPort.RequestReceived += (sender, args) => Log.Output("port:" + args.OriginatorHost + ":" + args.OriginatorPort);
//ForwardedPort.Exception += (sender, args) => Log.Error(args.Exception);
ForwardedPort.Start();
Thread.Sleep(1000 * 10);
//here it dies with message: "A blocking operation was interrupted by a call to WSACancelBlockingCall"
ForwardedPort.Stop();
}
return _currentTunnel;
}
}
}
```
I'm using SSH.NET.2013.4.7 when switched to 2014.4.6b2 I got "A first chance exception of type 'System.ObjectDisposedException' occurred in System.dll" instead, exactly in the same place.
here is sample class that replicates this error:
```
public class ExampleSSH
{
public static ConnectionInfo TunnelConfiguration { private get; set; }
public static ForwardedPortLocal ForwardedPort { get; private set; }
private static SshClient _currentTunnel;
public static SshClient CurrentTunnel
{
get
{
//establish connection if none
if (_currentTunnel == null)
{
_currentTunnel = new SshClient(TunnelConfiguration)
{
KeepAliveInterval = TimeSpan.FromMinutes(5)
};
//_currentTunnel.ErrorOccurred += (sender, args) => Log.Error(args.Exception);
//_currentTunnel.HostKeyReceived += (sender, args) => SSH.HandShake(args);
}
//connect if disconnected
if (_currentTunnel.IsConnected == false)
{
_currentTunnel.Connect();
//var currentShell = _currentTunnel.CreateShellStream("terminal", 80, 24, 800, 600, 1024);
//{
// currentShell.DataReceived += CurrentShellOnDataReceived;
//}
}
//forward ports if missing
if (!_currentTunnel.ForwardedPorts.Any())
{
ForwardedPort = new ForwardedPortLocal("localhost", Network.GetAvailablePort(DB.CurrentState), "localhost", 3306);
_currentTunnel.AddForwardedPort(ForwardedPort);
//ForwardedPort.RequestReceived += (sender, args) => Log.Output("port:" + args.OriginatorHost + ":" + args.OriginatorPort);
//ForwardedPort.Exception += (sender, args) => Log.Error(args.Exception);
ForwardedPort.Start();
Thread.Sleep(1000 * 10);
//here it dies with message: "A blocking operation was interrupted by a call to WSACancelBlockingCall"
ForwardedPort.Stop();
}
return _currentTunnel;
}
}
}
```