<?xml version="1.0"?><?xml-stylesheet type="text/xsl" href="/rss.xsl"?><rss version="2.0"><channel><title>SSH.NET Library</title><link>http://sshnet.codeplex.com/project/feeds/rss</link><description>SSH.NET is client library to connect to SSH servers written in C&amp;#35; with multitasking support.   </description><item><title>Created Unassigned: Remove Line Feed from WriteLine method in Shellstream Class [1584]</title><link>http://sshnet.codeplex.com/workitem/1584</link><description>When working with the expect method, it was discovered the WriteLine was sending an linefeed after a carriage return. This was throwing some SSH implementations off because the linefeed is being interpreted as a second carriage return.&lt;br /&gt;&lt;br /&gt;I&amp;#39;m suggesting that&amp;#58;&lt;br /&gt;&lt;br /&gt;var commandText &amp;#61; string.Format&amp;#40;&amp;#34;&amp;#123;0&amp;#125;&amp;#123;1&amp;#125;&amp;#34;, line, &amp;#34;&amp;#92;r&amp;#92;n&amp;#34;&amp;#41;&amp;#59;&lt;br /&gt;&lt;br /&gt;be replaced with&lt;br /&gt;&lt;br /&gt;var commandText &amp;#61; string.Format&amp;#40;&amp;#34;&amp;#123;0&amp;#125;&amp;#123;1&amp;#125;&amp;#34;, line, &amp;#34;&amp;#92;r&amp;#34;&amp;#41;&amp;#59;&lt;br /&gt;</description><author>jimmychanga</author><pubDate>Wed, 22 May 2013 14:57:29 GMT</pubDate><guid isPermaLink="false">Created Unassigned: Remove Line Feed from WriteLine method in Shellstream Class [1584] 20130522025729P</guid></item><item><title>New Post: SFTP Keyboard Interactive Authentication</title><link>http://sshnet.codeplex.com/discussions/444578</link><description>&lt;div style="line-height: normal;"&gt;Hi,&lt;br /&gt;
&lt;br /&gt;
I'm trying to get files via sftp, but I can figure out which classes I need to use. &lt;br /&gt;
At first I tried to connect by simply using an SftpClient object, like shown in an example I found&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;
    using (var sftp = new SftpClient(host, username, password))
    {
        sftp.Connect();

        using (var file = File.OpenRead(localFileName))
        {
            sftp.UploadFile(remoteFileName, file);
        }https://sshnet.codeplex.com/discussions/create#

        sftp.Disconnect();
    }&lt;/code&gt;&lt;/pre&gt;

but sftp.Connect(); throws an SSHAuthenticationException;&lt;br /&gt;
&lt;br /&gt;
Connecting to the server via putty i recognized it uses keyboard-interactive authentication and tried to creat the SftpClient like this:&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;            KeyboardInteractiveConnectionInfo conInfo = new KeyboardInteractiveConnectionInfo(host, port, username);

            SftpClient client = new SftpClient(conInfo);
            client.Connect();&lt;/code&gt;&lt;/pre&gt;

Which throws an ArgumentNullException.&lt;br /&gt;
&lt;br /&gt;
Whats the right way to creat an SftpClient connection?&lt;br /&gt;
&lt;/div&gt;</description><author>blueKiwi</author><pubDate>Wed, 22 May 2013 12:02:38 GMT</pubDate><guid isPermaLink="false">New Post: SFTP Keyboard Interactive Authentication 20130522120238P</guid></item><item><title>New Post: Shell functionlity</title><link>http://sshnet.codeplex.com/discussions/301739</link><description>&lt;div style="line-height: normal;"&gt;&lt;strong&gt;supermanSC wrote:&lt;/strong&gt;&lt;br /&gt;
&lt;blockquote&gt;
I'm trying to get this working on a Cisco 65xx switch, and can't seem to get past the enable password prompt.&amp;nbsp; Oleg, if you're not familiar with Cisco, once you connect using the primary username/password, you need to issue the &amp;quot;enable&amp;quot; command to gain some elevated access levels. Once that's issued, the router will respond with a &amp;quot;Password: &amp;quot; prompt, which requires a password to be entered.&amp;nbsp; For whatever reason, if I read to the end of the stream prior to entering a password, it's like something is either being entered, or a linefeed is sent across, in which case the Cisco replies with &amp;quot;Bad Password&amp;quot;.&amp;nbsp; Here's the small routine I'm testing with: &amp;nbsp;&amp;nbsp;&amp;nbsp; Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Using client = New SshClient(&amp;quot;1.1.1.1&amp;quot;, &amp;quot;username&amp;quot;, &amp;quot;password&amp;quot;)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; client.Connect()&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Using sshStream = client.CreateShellStream(&amp;quot;dumb&amp;quot;, 80, 24, 800, 600, 1024)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim reader = New StreamReader(sshStream)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim writer = New StreamWriter(sshStream)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; writer.AutoFlush = True&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; While sshStream.Length = 0&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Thread.Sleep(500)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; End While&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Response.Write(reader.ReadToEnd)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; writer.WriteLine(&amp;quot;enable&amp;quot;)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; While sshStream.Length = 0&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Thread.Sleep(500)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; End While&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Response.Write(reader.ReadToEnd.ToString.Replace(vbCrLf, &amp;quot;&amp;lt;BR&amp;gt;&amp;quot;))&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; End Using&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; client.Disconnect()&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; End Using&amp;nbsp;&amp;nbsp;&amp;nbsp; End Sub &amp;nbsp; ---- &amp;nbsp; Here's what's returned: test_6506&amp;gt;enablePassword: &amp;lt;--------------- I need to send a password here, yet something is being automatically sent in it's place.% Access deniedtest_6506&amp;gt;&lt;br /&gt;
&lt;/blockquote&gt;
I banged my head on this for a couple of days. I was also using the library to manage cisco routers. SharpSSH worked perfectly fine, but I couldn't get the expect function work correctly in SSH.NET.&lt;br /&gt;
&lt;br /&gt;
After re-reading this thread multiple times, this post got me thinking that there had to be something different between SharpSSH's writeline method and SSH.NET's.&lt;br /&gt;
&lt;br /&gt;
After looking at both library's source I found that SharpSSH is only sending a \r where SSH.NET is sending \r\n. The Cisco's are interpreting the \r\n as a double enter key press.&lt;br /&gt;
&lt;br /&gt;
I changed my code to use write and appended the \r and everything works like a champ.&lt;br /&gt;
&lt;/div&gt;</description><author>jimmychanga</author><pubDate>Wed, 22 May 2013 06:09:15 GMT</pubDate><guid isPermaLink="false">New Post: Shell functionlity 20130522060915A</guid></item><item><title>New Post: ExpectAction Problem</title><link>http://sshnet.codeplex.com/discussions/444195</link><description>&lt;div style="line-height: normal;"&gt;Never mind, I found the issue that had been plaguing me.&lt;br /&gt;
&lt;br /&gt;
The root cause of my problem was that I didn't realize that WriteLine was sending &amp;quot;\r\n&amp;quot;. Cisco routers don't line the linefeed. This had worked with SharpSSH, but it was only sending &amp;quot;\r&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
So I changed everything to Write and added the \r to my data. Now everything works.&lt;br /&gt;
&lt;/div&gt;</description><author>jimmychanga</author><pubDate>Wed, 22 May 2013 06:02:24 GMT</pubDate><guid isPermaLink="false">New Post: ExpectAction Problem 20130522060224A</guid></item><item><title>New Post: Pageant integration?</title><link>http://sshnet.codeplex.com/discussions/434618</link><description>&lt;div style="line-height: normal;"&gt;I tried to create a 64bit build of my application with SshNet+Pageant, but could only get the Pageant API to work when building as a 32 bit application.  Not knowing the details of the Pageant protocol, I suspect the Pageant API is arch dependent.&lt;br /&gt;
&lt;br /&gt;
Are there any suggestions for detecting which Pageant build is running and adapting to the API appropriately for this patch?&lt;br /&gt;
&lt;/div&gt;</description><author>xl600</author><pubDate>Tue, 21 May 2013 17:34:57 GMT</pubDate><guid isPermaLink="false">New Post: Pageant integration? 20130521053457P</guid></item><item><title>Created Unassigned: Infinite loop in SocketReadLine Method [1582]</title><link>http://sshnet.codeplex.com/workitem/1582</link><description>First of all you are doing a great job, Thank&amp;#39;s for that. &lt;br /&gt;Where was an infinite loop ,do &amp;#123;..&amp;#125; while &amp;#123;.. buffer&amp;#91;buffer.Count - 1&amp;#93; &amp;#61;&amp;#61; 0x0A ...&amp;#125; condition wasn&amp;#39;t true, and a i get exception SshOperationTimeoutException&amp;#40;&amp;#34;Socket read operation has timed out&amp;#34;&amp;#41;, that was strange, i changed condition to &lt;br /&gt;while &amp;#40;&amp;#33;&amp;#40;buffer.Count &amp;#62; 0 &amp;#38;&amp;#38; &amp;#40;buffer&amp;#91;buffer.Count - 1&amp;#93;.Equals&amp;#40;0x0A&amp;#41; &amp;#124;&amp;#124; buffer&amp;#91;buffer.Count - 1&amp;#93;.Equals&amp;#40;0x00&amp;#41; &amp;#41;&amp;#41;&amp;#41;&amp;#59;&lt;br /&gt;and now everything works great. Thank one more time for your library.&lt;br /&gt;</description><author>zolotoych</author><pubDate>Tue, 21 May 2013 12:24:51 GMT</pubDate><guid isPermaLink="false">Created Unassigned: Infinite loop in SocketReadLine Method [1582] 20130521122451P</guid></item><item><title>New Post: Odd reoccurring exception</title><link>http://sshnet.codeplex.com/discussions/265341</link><description>&lt;div style="line-height: normal;"&gt;Apologies for digging up an old thread, but I'm getting a similar issue.. but only when running on 64-bit (havent seen it on 32-bit OS so far). It's 100% reproducible on 64-bit, so hopefully we can track it down:&lt;br /&gt;
&lt;br /&gt;
Application: NodeService.exe&lt;br /&gt;
Framework Version: v4.0.30319&lt;br /&gt;
Description: The process was terminated due to an unhandled exception.&lt;br /&gt;
Exception Info: System.AccessViolationException&lt;br /&gt;
Stack:&lt;br /&gt;
  at Renci.SshNet.ShellStream.Channel_DataReceived(System.Object, Renci.SshNet.Common.ChannelDataEventArgs)&lt;br /&gt;
   at Renci.SshNet.Channels.Channel.OnData(Byte[])&lt;br /&gt;
   at Renci.SshNet.Channels.Channel.OnChannelData(System.Object, Renci.SshNet.MessageEventArgs`1&amp;lt;Renci.SshNet.Messages.Connection.ChannelDataMessage&amp;gt;)&lt;br /&gt;
   at Renci.SshNet.Session.OnChannelDataReceived(Renci.SshNet.Messages.Connection.ChannelDataMessage)&lt;br /&gt;
   at Renci.SshNet.Session.HandleMessage(Renci.SshNet.Messages.Connection.ChannelDataMessage)&lt;br /&gt;
   at System.Dynamic.UpdateDelegates.UpdateAndExecuteVoid2[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]](System.Runtime.CompilerServices.CallSite, System.__Canon, System.__Canon)&lt;br /&gt;
   at Renci.SshNet.Session.HandleMessageCore(Renci.SshNet.Messages.Message)&lt;br /&gt;
   at Renci.SshNet.Session.MessageListener()&lt;br /&gt;
   at Renci.SshNet.Session.&amp;lt;Connect&amp;gt;b__4()&lt;br /&gt;
   at Renci.SshNet.Session+&amp;lt;&amp;gt;c__DisplayClass3d.&amp;lt;ExecuteThread&amp;gt;b__3c(System.Object)&lt;br /&gt;
   at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)&lt;br /&gt;
   at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)&lt;br /&gt;
   at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()&lt;br /&gt;
   at System.Threading.ThreadPoolWorkQueue.Dispatch()&lt;br /&gt;
&lt;br /&gt;
Machine was running Windows 7 64-bit, with .Net 4.5.&lt;br /&gt;
&lt;br /&gt;
I'll try installing VS on the machine and see if I can get any insight.&lt;br /&gt;
&lt;br /&gt;
thx&lt;br /&gt;
Steve&lt;br /&gt;
&lt;/div&gt;</description><author>rousseauhk</author><pubDate>Tue, 21 May 2013 09:37:36 GMT</pubDate><guid isPermaLink="false">New Post: Odd reoccurring exception 20130521093736A</guid></item><item><title>Commented Issue: Exception thrown on disconnect [1561]</title><link>http://sshnet.codeplex.com/workitem/1561</link><description>If SshClient.Disconnect&amp;#40;&amp;#41; is called just after the connected server is no longer available an exception occurs. Looks like there is a race condition on calling Disconnect. Checks are made for a connection before a DisconnectMessage is sent to the server but the server could be disconnected in between the time that the connection check is done and the message is sent. I have a scenario where this can happen quite easily.  &lt;br /&gt;&lt;br /&gt;I understand that I could put a try catch around the SshClient.Disconnect call but it seems like the better place for the try catch would be in the session class where the disconnect message is being sent.  If an exception is thrown during a disconnect it could just be ignored.&lt;br /&gt;Comments: ** Comment from web user: winkledumpling ** &lt;p&gt;I believe this is the same issue as&lt;br&gt;https://sshnet.codeplex.com/workitem/1581&lt;/p&gt;</description><author>winkledumpling</author><pubDate>Mon, 20 May 2013 06:24:36 GMT</pubDate><guid isPermaLink="false">Commented Issue: Exception thrown on disconnect [1561] 20130520062436A</guid></item><item><title>New Post: ExpectAction Problem</title><link>http://sshnet.codeplex.com/discussions/444195</link><description>&lt;div style="line-height: normal;"&gt;Is it correct to assume that only two &amp;quot;choice&amp;quot; can be used in an ExpectAction?&lt;br /&gt;
&lt;br /&gt;
I'm trying to issue a traceroute command on a cisco router without the host specified. This causes the CLI to ask for additional information, including target and source host. A total of 10 questions are asked before the command is successfully executed.&lt;br /&gt;
&lt;br /&gt;
I thought I could just chain ExpectActions as so:&lt;br /&gt;
&lt;pre&gt;&lt;code&gt; ss.Expect(
                            new ExpectAction(@&amp;quot;Protocol \[ip\]: &amp;quot;, (s) =&amp;gt;
                                {
                                    ss.WriteLine(&amp;quot;ip&amp;quot;);
                                    _reply += s;
                                }),
                            new ExpectAction(@&amp;quot;Target IP address: &amp;quot;, (s) =&amp;gt;
                                {
                                    ss.WriteLine(dIpAddress);
                                    _reply += s;
                                }),
                            new ExpectAction(@&amp;quot;Source address: &amp;quot;, (s) =&amp;gt;
                                {
                                    ss.WriteLine(sIpAddress);
                                    _reply += s;
                                }),
                            new ExpectAction(@&amp;quot;Numeric display \[n\]: &amp;quot;, (s) =&amp;gt;
                                {
                                    ss.WriteLine(&amp;quot;n&amp;quot;);
                                    _reply += s;
                                }),
                            new ExpectAction(@&amp;quot;Timeout in seconds [3]: &amp;quot;, (s) =&amp;gt;
                                {
                                    ss.WriteLine(&amp;quot;3&amp;quot;);
                                    _reply += s;
                                }),
                            new ExpectAction(@&amp;quot;Probe count [3]: &amp;quot;, (s) =&amp;gt;
                                {
                                    ss.WriteLine(&amp;quot;3&amp;quot;);
                                    _reply += s;
                                }),
                            new ExpectAction(@&amp;quot;Minimum Time to Live [1]: &amp;quot;, (s) =&amp;gt;
                                {
                                    ss.WriteLine(&amp;quot;1&amp;quot;);
                                    _reply += s;
                                }),
                            new ExpectAction(@&amp;quot;Maximum Time to Live [30]: &amp;quot;, (s) =&amp;gt;
                                {
                                    ss.WriteLine(&amp;quot;30&amp;quot;);
                                    _reply += s;
                                }),
                            new ExpectAction(@&amp;quot;Port Number [33434]: &amp;quot;, (s) =&amp;gt;
                                {
                                    ss.WriteLine(&amp;quot;33434&amp;quot;);
                                    _reply += s;
                                }),
                            new ExpectAction(@&amp;quot;Loose, Strict, Record, Timestamp, Verbose[none]: &amp;quot;, (s) =&amp;gt;
                                {
                                    ss.WriteLine(&amp;quot; &amp;quot;);
                                    _reply += s;
                                }),
                            new ExpectAction(new Regex(@&amp;quot;\\*  \\*  \\*&amp;quot;), (s) =&amp;gt;
                                {
                                    _reply = s;
                                    _reply += s;
                                })
                            );&lt;/code&gt;&lt;/pre&gt;

However, only the first two are ever processed.&lt;br /&gt;
&lt;br /&gt;
I assume I'm doing this wrong. I appreciate any input.&lt;br /&gt;
&lt;/div&gt;</description><author>jimmychanga</author><pubDate>Sun, 19 May 2013 14:28:55 GMT</pubDate><guid isPermaLink="false">New Post: ExpectAction Problem 20130519022855P</guid></item><item><title>Commented Issue: Unhandled exception during SftpClient Dispose [1581]</title><link>http://sshnet.codeplex.com/workitem/1581</link><description>We are facing an unhandled exception during Dispose of the SftpClient. &lt;br /&gt;&lt;br /&gt;2013-05-13 12&amp;#58;54&amp;#58;22,711 &amp;#91;2&amp;#93; FATAL - AppDomain.UnhandledException&lt;br /&gt;Renci.SshNet.Common.SshConnectionException&amp;#58; Client not connected.&lt;br /&gt;   at Renci.SshNet.Session.SendMessage&amp;#40;Message message&amp;#41;&lt;br /&gt;   at Renci.SshNet.Channels.Channel.Close&amp;#40;Boolean wait&amp;#41;&lt;br /&gt;   at Renci.SshNet.Channels.ChannelSession.Close&amp;#40;Boolean wait&amp;#41;&lt;br /&gt;   at Renci.SshNet.Channels.Channel.Dispose&amp;#40;Boolean disposing&amp;#41;&lt;br /&gt;   at Renci.SshNet.Sftp.SubsystemSession.Dispose&amp;#40;Boolean disposing&amp;#41;&lt;br /&gt;   at Renci.SshNet.Sftp.SftpSession.Dispose&amp;#40;Boolean disposing&amp;#41;&lt;br /&gt;   at Renci.SshNet.SftpClient.Dispose&amp;#40;Boolean disposing&amp;#41;&lt;br /&gt;   at Renci.SshNet.BaseClient.Finalize&amp;#40;&amp;#41;&lt;br /&gt;&lt;br /&gt;This happens when the connection to the Ssh server is lost and affects our ability to gracefully handle situations when servers&amp;#47;connectivity goes down. O&lt;br /&gt;&lt;br /&gt;The solution I suggest to swallow any exceptions coming from SftpClient.Dispose&amp;#40;&amp;#41; as follows. Not pretty but as a general rule, Dispose shouldnt be throwing exceptions, unless such exceptions are symtomatic of a more serious problem.&lt;br /&gt;&lt;br /&gt;Cheers&lt;br /&gt;&lt;br /&gt;        protected override void Dispose&amp;#40;bool disposing&amp;#41;&lt;br /&gt;        &amp;#123;&lt;br /&gt;            try&lt;br /&gt;            &amp;#123;&lt;br /&gt;                if &amp;#40;this._sftpSession &amp;#33;&amp;#61; null&amp;#41;&lt;br /&gt;                &amp;#123;&lt;br /&gt;                    this._sftpSession.Dispose&amp;#40;&amp;#41;&amp;#59;&lt;br /&gt;                    this._sftpSession &amp;#61; null&amp;#59;&lt;br /&gt;                &amp;#125;&lt;br /&gt;&lt;br /&gt;                if &amp;#40;this._disposeConnectionInfo&amp;#41;&lt;br /&gt;                    &amp;#40;&amp;#40;IDisposable&amp;#41;this.ConnectionInfo&amp;#41;.Dispose&amp;#40;&amp;#41;&amp;#59;&lt;br /&gt;&lt;br /&gt;                base.Dispose&amp;#40;disposing&amp;#41;&amp;#59;&lt;br /&gt;            &amp;#125;&lt;br /&gt;            catch&lt;br /&gt;            &amp;#123;&lt;br /&gt;                &amp;#47;&amp;#47; swallow it&lt;br /&gt;            &amp;#125;&lt;br /&gt;        &amp;#125;&lt;br /&gt;Comments: ** Comment from web user: Mister_Goodcat ** &lt;p&gt;Hi. I think your problem, that of user &amp;quot;pmilin&amp;quot; and mine are similar and/or related, see:&lt;/p&gt;&lt;p&gt;https://sshnet.codeplex.com/workitem/1561&lt;/p&gt;&lt;p&gt;In my case, I am _not_ able to solve the problem with catching exceptions (for details see the above work item).&lt;/p&gt;</description><author>Mister_Goodcat</author><pubDate>Fri, 17 May 2013 16:46:30 GMT</pubDate><guid isPermaLink="false">Commented Issue: Unhandled exception during SftpClient Dispose [1581] 20130517044630P</guid></item><item><title>Commented Issue: Exception thrown on disconnect [1561]</title><link>http://sshnet.codeplex.com/workitem/1561</link><description>If SshClient.Disconnect&amp;#40;&amp;#41; is called just after the connected server is no longer available an exception occurs. Looks like there is a race condition on calling Disconnect. Checks are made for a connection before a DisconnectMessage is sent to the server but the server could be disconnected in between the time that the connection check is done and the message is sent. I have a scenario where this can happen quite easily.  &lt;br /&gt;&lt;br /&gt;I understand that I could put a try catch around the SshClient.Disconnect call but it seems like the better place for the try catch would be in the session class where the disconnect message is being sent.  If an exception is thrown during a disconnect it could just be ignored.&lt;br /&gt;Comments: ** Comment from web user: Mister_Goodcat ** &lt;p&gt;Hi. &lt;/p&gt;&lt;p&gt;I seem to have the same or at least a related problem, however the consequences are a lot more fatal on my end. Scenario here:&lt;/p&gt;&lt;p&gt;* I connect to a remote server to invoke a command that gracefully shuts down the services there and then turns off the device (it's a NAS). That means that the SSH service is shut down on the server side when I'm still connected.&lt;br&gt;* On the client, I see two things: first of all the callback of the asynchronously executed command is never invoked, which I think is not expected. I would expect the command to finish and throw an exception when I invoke the EndExecute method in my callback. The only possibility to get notified about the disconnect is to hook the ErrorOccurred event on the client.&lt;br&gt;* When I try to Disconnect() or Dispose() in that event handler, I seem to get the same race condition, however in my case execution simply hangs and never continues (looks like a dead lock to me, haven't looked at the actual code).&lt;/p&gt;&lt;p&gt;This behavior is fatal on my dev machine when I debug my code in Visual Studio 2012: execution hangs as soon as I invoke Disconnect(), and when I then stop debugging (Shift+F5) __Windows 8 crashes with a BSOD__ telling me the process has still locked pages. I could reproduce this behavior three times in a row after clean reboots.&lt;/p&gt;&lt;p&gt;Running the application outside of Visual Studio does not result in a BSOD, however the thread my code executes on simply dies and never recovers until the process is shut down.&lt;/p&gt;&lt;p&gt;I still think your library is an excellent project and would like to thank you for it; if you could fix that problem, it would be perfect for my use case.&lt;/p&gt;&lt;p&gt;-Peter&lt;/p&gt;</description><author>Mister_Goodcat</author><pubDate>Fri, 17 May 2013 16:41:59 GMT</pubDate><guid isPermaLink="false">Commented Issue: Exception thrown on disconnect [1561] 20130517044159P</guid></item><item><title>New Post: Zlib compression support</title><link>http://sshnet.codeplex.com/discussions/443647</link><description>&lt;div style="line-height: normal;"&gt;I followed the last comment mentioned in &lt;a href="https://sshnet.codeplex.com/workitem/219" rel="nofollow"&gt;Issue 219&lt;/a&gt;, and I am able to get zlib compression working.   Thanks olegkap!  By the way, in addition to uncommenting lines in Zlibstream.cs, I also have to update variable CompressionAlgorithms in ConnectionInfo.cs.&lt;br /&gt;
&lt;/div&gt;</description><author>tony1</author><pubDate>Thu, 16 May 2013 21:38:13 GMT</pubDate><guid isPermaLink="false">New Post: Zlib compression support 20130516093813P</guid></item><item><title>Closed Issue: Unobserved exception rethrown by finalizer thread [1298]</title><link>http://sshnet.codeplex.com/workitem/1298</link><description>Hi,&amp;#160;There is an unhandled System.AggregateException in a worker thread within SSH.NET version 18974 that causes the container application to crash. The exception should be caught and rethrown to the caller. This error occurs when the connection between the SHH client and server is flaky, i.e. it comes on and off. I added an AppDomain unhandled exception handler to log the exception. Here is the stack trace of the exception&amp;#58;&amp;#160;ERROR&amp;#58; SubsystemSession.cs&amp;#40;128&amp;#41;&amp;#58; Object reference not set to an instance of an object.ERROR&amp;#58; SubsystemSession.cs&amp;#40;169&amp;#41;&amp;#58; Renci.SshNet.Sftp.SubsystemSession.Session_ErrorOccured&amp;#40;Object sender, ExceptionEventArgs e&amp;#41; failed.ERROR&amp;#58; System.EventHandler&amp;#96;1.Invoke&amp;#40;Object sender, TEventArgs e&amp;#41; failed.ERROR&amp;#58; Session.cs&amp;#40;1929&amp;#41;&amp;#58; Renci.SshNet.Session.RaiseError&amp;#40;Exception exp&amp;#41; failed.ERROR&amp;#58; Session.cs&amp;#40;1592&amp;#41;&amp;#58; Renci.SshNet.Session.MessageListener&amp;#40;&amp;#41; failed.ERROR&amp;#58; Session.cs&amp;#40;522&amp;#41;&amp;#58; Renci.SshNet.Session.b__14&amp;#40;&amp;#41; failed.ERROR&amp;#58; System.Threading.Tasks.Task.InnerInvoke&amp;#40;&amp;#41; failed.ERROR&amp;#58; System.Threading.Tasks.Task.Execute&amp;#40;&amp;#41; failed.ERROR&amp;#58; A Task&amp;#39;s exception&amp;#40;s&amp;#41; were not observed either by Waiting on the Task or accessing its Exception property. As a result, the unobserved exception was rethrown by the finalizer thread.ERROR&amp;#58; Application domain unhandled exception.&amp;#160;I am not too familar with Tasks, but I suspect the error could be fixed by adding a catch block to the try block at Session.cs, line 520, and rethrow the exception. I am posting this while I am trying to fix the issue in case someone else can help.&amp;#160;Thanks,&amp;#160;Robert&lt;br /&gt;</description><author>jsf75</author><pubDate>Thu, 16 May 2013 12:14:07 GMT</pubDate><guid isPermaLink="false">Closed Issue: Unobserved exception rethrown by finalizer thread [1298] 20130516121407P</guid></item><item><title>Closed Feature: File Transfer Progress [1324]</title><link>http://sshnet.codeplex.com/workitem/1324</link><description>&amp;#42;&amp;#42; Added Issue as status PROPOSED type FEATURE &amp;#42;&amp;#42;This is a discussion thread.&amp;#160;Is there any interest in including a way to expose current transfer progress to an application&amp;#63;&amp;#160;For example, imagine a user wanting to upload a file could pass in an implementation of&amp;#58;&amp;#160;&amp;#160;&amp;#160;&amp;#160;public interface IFileTransferHandler&amp;#123;    ulong BytesRead &amp;#123; get&amp;#59; &amp;#125;&amp;#160;    void IncrementBytesRead&amp;#40;ulong bytes&amp;#41;&amp;#59;&amp;#160;    void TransferCompleted&amp;#40;&amp;#41;&amp;#59;&amp;#125;&amp;#160;&amp;#160;&amp;#160;&amp;#160;Whenever the callback for Write returns confirming that the bytes were written, IncrementReadBytes would be called and whenever the file is fully uploaded TransferCompleted gets called. Since we&amp;#39;re passing in streams, there&amp;#39;s no objective way to determine the file size so that would have to be provided in the implementation, if at all.&amp;#160;All you really need to do is add a field for that interface in SftpFileStream and then pass it to all calls to RequestWrite and then create some new constructors so that the interface can be passed along from the publicly exposed methods &amp;#40;I&amp;#39;ve managed to build a sample implementation for sftp upload, so this method works&amp;#41;. The only issue is if the handler throws an exception. Since it&amp;#39;s asynchronous the debugger displays the stack trace in the wrong place and could confuse developers.&lt;br /&gt;</description><author>olegkap</author><pubDate>Thu, 16 May 2013 12:14:06 GMT</pubDate><guid isPermaLink="false">Closed Feature: File Transfer Progress [1324] 20130516121406P</guid></item><item><title>Closed Issue: SCP : Missing files when using DirectoryUpload [1382]</title><link>http://sshnet.codeplex.com/workitem/1382</link><description>Hi,I have the following environment&amp;#58;- Win7 &amp;#47; 64- .NET 3.5- MPC-Target &amp;#58;OpenSSH_6.0p1, OpenSSL 1.0.0j 10 May 2012- SSH.NET commit 19813I want to upload a directory structure &amp;#40;recursive, depth &amp;#61; 2&amp;#41; from the PC to a MPC basedLinux remote system. The total amount of data is about 8MB with 23 files from55 bytes to 4MB.Calling mScp.Upload&amp;#40;new DirectoryInfo&amp;#40;localDir&amp;#41;, remoteDir&amp;#41; does not result anyerror and the Uploading event shoes uploading all files. But after Upload&amp;#40;&amp;#41; returnedThere are a random number of missing files on the target &amp;#40;between 1 and 5&amp;#41;.It tried the same with a PC based Linux as target what resulted in the same behaviour&amp;#40;OpenSSH_5.8p1 Debian-7ubuntu1, OpenSSL 1.0.0e 6 Sep 2011&amp;#41;. It seems theproblem is caused anywhere within SSH.NET.Does anyone have a solution&amp;#63;Extension&amp;#58;I tried to workaround by replacing Upload&amp;#40;new DirectoryInfo&amp;#40;...&amp;#41;&amp;#41; by several singlecalls of Upload&amp;#40;new FileInfo&amp;#40;...&amp;#41;&amp;#41;. This worked but is too slow for my application.&lt;br /&gt;</description><author>olegkap</author><pubDate>Thu, 16 May 2013 12:14:05 GMT</pubDate><guid isPermaLink="false">Closed Issue: SCP : Missing files when using DirectoryUpload [1382] 20130516121405P</guid></item><item><title>Closed Issue: Dispose() should not leave running threads behind! [1436]</title><link>http://sshnet.codeplex.com/workitem/1436</link><description>Hi. I have found a really hard to find bug that is very consistently repeatable. Before getting into the details, I think it should be noted that this issue will be resolved if the Renci.SshNet.SshClient.Dispose&amp;#40;&amp;#41; and the Renci.SshNet.ForwardedPortLocal.Dispose&amp;#40;&amp;#41; &amp;#40;and anything else&amp;#41; actually and honestly dispose everything. But the problem is that after calling those, there are still threads hanging around doing stuff and sometimes they get stuck badly. It looks like someone went crazy with anonymous methods and launching Thread Tasks without leaving a handle to the Thread for management by the parents to kill them when disposed. And I found in Session.NET40.cs this line&amp;#58;            Task.Factory.StartNew&amp;#40;action, TaskCreationOptions.LongRunning&amp;#41;&amp;#59;which I changed to&amp;#58;            Task.Factory.StartNew&amp;#40;action, TaskCreationOptions.AttachedToParent&amp;#41;&amp;#59;but it had no positive impact.I have seen posts on this site about Disconnect doing funny stuff and also about the Timeouts not seeming to disconnect things, and some other things like that. I bet they are related to getting over your head in multi-threading or events.The result is that sometimes I still have the process listening on the local port way after the Dispose&amp;#40;&amp;#41; is called. And also the Connection is sitting there too.  Usually this happens when eliminating both the Forwards and the Connection, but sometimes even just the Forwards. The call to the Forward&amp;#39;s Disconnect&amp;#40;&amp;#41; and Dispose&amp;#40;&amp;#41; when the problem happens will take a much longer time, but then sadly continue going after seemingly giving up.When I pause I can see 2 Renci threads hanging around and stuck at these points&amp;#58;ForwardedPortLocal.NET.cs line 34&amp;#58;                        var socket &amp;#61; this._listener.AcceptSocket&amp;#40;&amp;#41;&amp;#59;Session.cs line 1575&amp;#58;                    var message &amp;#61; this.ReceiveMessage&amp;#40;&amp;#41;&amp;#59;I have tested this A LOT&amp;#33;&amp;#33;&amp;#33; trying to find ways around it. It happens in the code base &amp;#40;pulled today 12&amp;#47;5&amp;#47;12&amp;#41;, it happens in .Net 4.0 DLL from a month ago, and it happens from .Net 3.5 DLL pulled today also. Another result is that sometimes the situation causes the app to die a horrible death with&amp;#58;System.AggregateException was unhandled  Message&amp;#61;A Task&amp;#39;s exception&amp;#40;s&amp;#41; were not observed either by Waiting on the Task or accessing its Exception property. As a result, the unobserved exception was rethrown by the finalizer thread.  Source&amp;#61;mscorlib  StackTrace&amp;#58;       at System.Threading.Tasks.TaskExceptionHolder.Finalize&amp;#40;&amp;#41;  InnerException&amp;#58; System.NullReferenceException       Message&amp;#61;Object reference not set to an instance of an object.       Source&amp;#61;Renci.SshNet       StackTrace&amp;#58;            at Renci.SshNet.ForwardedPortLocal.b__0&amp;#40;&amp;#41;            at System.Threading.Tasks.Task.InnerInvoke&amp;#40;&amp;#41;            at System.Threading.Tasks.Task.Execute&amp;#40;&amp;#41;WHEN DOES THIS HAPPEN&amp;#58;Here is the kicker.  I wrote an app to manage SSH tunnels. And when I first was having problems with Renci, I made it so I can implement other libraries and other means. Via a config file I can add and remove tunnels and have multiple connections. The process reads the config file periodically and applies the changes found. So I can have a connection using Renci, another using Chilkat, another using Plink, Tunnelier, and that&amp;#39;s all I finished implementing so far.If I have all Renci connections, it seems that I can add and remove tunnels and connections a bunch of times and not have an issue. &amp;#40;however usually there is a Connection &amp;#40;SshClient&amp;#41; that hangs around in CLOSE_WAIT state&amp;#41;. If I bring say Chilkat into the mix, things still are OK.. and I can replace all active connections to one of the other implementations.The problems start happening when I bring in Plink or Tunnelier. They are launched using System.Process. They close themselves properly from what I see in memory and via TCP connections and SSH server. When I have a Renci and Plink &amp;#40;let&amp;#39;s say&amp;#41; connection, it is then that if I start removing tunnels from Renci I might have issues. If I start removing the Connection, I almost always have an issue.The issue is that when Renci is told to close up shop, it stalls for a while, and then the code moves on while leaving the listeners in place &amp;#40;though of course not working&amp;#41;. And they stay there it seems indefinitely. And I&amp;#39;m also using System.Net.NetworkInformation.IPGlobalProperties.GetIPGlobalProperties&amp;#40;&amp;#41;.GetActiveTcpListeners&amp;#40;&amp;#41; to look at the listeners and it&amp;#39;s there. It&amp;#39;s because there are those silly Renci threads that are hanging around for some reason trying to read from the socket.And I have verified that the Connection replacement &amp;#40;like Plink&amp;#41; is not actually opening up that tunnel. I have my app now specifically checks for the Active listeners before moving tunnels to another connection.This may be a very complicated specific bug to find, but I think the real root of the problem and the much easier one to fix, is that when you Dispose&amp;#40;&amp;#41;, it really should be DISPOSED, leaving no threads behind. I have also verified that calling SshClient.Dispose&amp;#40;&amp;#41; does not DISCONNECT, so you have to call both. I think also similar thing with the Forward.. if you don&amp;#39;t call Stop&amp;#40;&amp;#41;.This is how I stop the connections and port forwards&amp;#58;            foreach &amp;#40;ForwardedPort forward in this.sshConnection.ForwardedPorts.ToList&amp;#40;&amp;#41;&amp;#41;            &amp;#123;                this.sshConnection.RemoveForwardedPort&amp;#40;forward&amp;#41;&amp;#59;                Console.WriteLine&amp;#40;&amp;#34;just finished removing tunnel&amp;#34;&amp;#41;&amp;#59;            &amp;#125;            this.sshConnection.Disconnect&amp;#40;&amp;#41;&amp;#59;            Console.WriteLine&amp;#40;&amp;#34;just finished conn Disconnect&amp;#40;&amp;#41;&amp;#34;&amp;#41;&amp;#59;            this.sshConnection.Dispose&amp;#40;&amp;#41;&amp;#59;            Console.WriteLine&amp;#40;&amp;#34;just finished conn Dispose&amp;#40;&amp;#41;&amp;#34;&amp;#41;&amp;#59;        public void Dispose&amp;#40;&amp;#41;        &amp;#123;            if &amp;#40;this.localForward &amp;#33;&amp;#61; null&amp;#41;            &amp;#123;                this.localForward.Stop&amp;#40;&amp;#41;&amp;#59;                Console.WriteLine&amp;#40;&amp;#34;just finished tunnel Stop&amp;#40;&amp;#41;&amp;#34;&amp;#41;&amp;#59;                this.localForward.Dispose&amp;#40;&amp;#41;&amp;#59;                Console.WriteLine&amp;#40;&amp;#34;just finished tunnel Disconnect&amp;#40;&amp;#41;&amp;#34;&amp;#41;&amp;#59;                &amp;#47;&amp;#47;System.Threading.Thread.Sleep&amp;#40;2000&amp;#41;&amp;#59;            &amp;#125;        &amp;#125;&lt;br /&gt;</description><author>olegkap</author><pubDate>Thu, 16 May 2013 12:14:04 GMT</pubDate><guid isPermaLink="false">Closed Issue: Dispose() should not leave running threads behind! [1436] 20130516121404P</guid></item><item><title>Closed Issue: Invalid handling of http proxy server response [1509]</title><link>http://sshnet.codeplex.com/workitem/1509</link><description>Hi,&lt;br /&gt;&lt;br /&gt;I did find a problem when testing the assembly with our squid 3.0 proxy. I receive the message, that Result cannot be called on a failed match. Therefore I&amp;#39;ve extended the code in Session.cs a little bit&amp;#58;&lt;br /&gt; &lt;br /&gt;                if &amp;#40;statusCode &amp;#61;&amp;#61; 200 &amp;#38;&amp;#38; string.IsNullOrEmpty&amp;#40;response&amp;#41;&amp;#41;&lt;br /&gt;                &amp;#123;&lt;br /&gt;                    &amp;#47;&amp;#47;  Once all HTTP header information is read, exit&lt;br /&gt;                    break&amp;#59;&lt;br /&gt;                &amp;#125;&lt;br /&gt;                else&lt;br /&gt;                &amp;#123;&lt;br /&gt;                    string reasonPhrase &amp;#61; string.Empty&amp;#59;&lt;br /&gt;&lt;br /&gt;                    try&lt;br /&gt;                    &amp;#123;&lt;br /&gt;                        if &amp;#40;match.Success&amp;#41;&lt;br /&gt;                            reasonPhrase &amp;#61; match.Result&amp;#40;&amp;#34;&amp;#36;&amp;#123;reasonPhrase&amp;#125;&amp;#34;&amp;#41;&amp;#59;&lt;br /&gt;                    &amp;#125;&lt;br /&gt;                    catch &amp;#40;Exception ex&amp;#41;&lt;br /&gt;                    &amp;#123;&lt;br /&gt;                        reasonPhrase &amp;#61; string.Empty&amp;#59;&lt;br /&gt;                    &amp;#125;&lt;br /&gt; &lt;br /&gt;Now the following line&lt;br /&gt;&lt;br /&gt;throw new ProxyException&amp;#40;string.Format&amp;#40;&amp;#34;HTTP&amp;#58; Status code &amp;#123;0&amp;#125;, Reason &amp;#92;&amp;#34;&amp;#123;1&amp;#125;&amp;#92;&amp;#34;&amp;#34;, statusCode, reasonPhrase&amp;#41;&amp;#41;&amp;#59;&lt;br /&gt;&lt;br /&gt;Does at least return the error code &amp;#40;not yet the fault reason&amp;#59; in this case ERR_ACCESS_DENIED&amp;#41;&lt;br /&gt;&lt;br /&gt;In fact the code received a 403 status code from the proxy&amp;#58;&lt;br /&gt;&lt;br /&gt;SshNet.Logging Verbose&amp;#58; 1 &amp;#58; Initiating connect to &amp;#39;yyy.xxx.zzz.ww&amp;#58;22&amp;#39;.&lt;br /&gt;&lt;br /&gt;HTTP&amp;#47;1.0 403 Forbidden&lt;br /&gt;Server&amp;#58; squid&amp;#47;3.0.STABLE16-RC1&lt;br /&gt;Mime-Version&amp;#58; 1.0&lt;br /&gt;Date&amp;#58; Wed, 13 Feb 2013 14&amp;#58;15&amp;#58;06 GMT&lt;br /&gt;Content-Type&amp;#58; text&amp;#47;html&lt;br /&gt;Content-Length&amp;#58; 1008&lt;br /&gt;Expires&amp;#58; Wed, 13 Feb 2013 14&amp;#58;15&amp;#58;06 GMT&lt;br /&gt;X-Squid-Error&amp;#58; ERR_ACCESS_DENIED 0&lt;br /&gt;X-Cache&amp;#58; MISS from app-proxy-3.xxxx.xxx&lt;br /&gt;Via&amp;#58; 1.0 app-proxy-3.xxxx.xxx &amp;#40;squid&amp;#47;3.0.STABLE16-RC1&amp;#41;&lt;br /&gt;Proxy-Connection&amp;#58; close&lt;br /&gt;&lt;br /&gt;The thread 0xa2c has exited with code 0 &amp;#40;0x0&amp;#41;.&lt;br /&gt;&lt;br /&gt;Kind regards&lt;br /&gt;&lt;br /&gt;Johannes&lt;br /&gt;</description><author>olegkap</author><pubDate>Thu, 16 May 2013 12:14:00 GMT</pubDate><guid isPermaLink="false">Closed Issue: Invalid handling of http proxy server response [1509] 20130516121400P</guid></item><item><title>Closed Issue: SCP Can't Upload Rooted Directories [1511]</title><link>http://sshnet.codeplex.com/workitem/1511</link><description>As per the discussion &amp;#91;here&amp;#93;&amp;#40;http&amp;#58;&amp;#47;&amp;#47;sshnet.codeplex.com&amp;#47;discussions&amp;#47;284021&amp;#41;, SCP doesn&amp;#39;t currently work when uploading rooted folders.&lt;br /&gt;</description><author>olegkap</author><pubDate>Thu, 16 May 2013 12:14:00 GMT</pubDate><guid isPermaLink="false">Closed Issue: SCP Can't Upload Rooted Directories [1511] 20130516121400P</guid></item><item><title>Closed Issue: Process terminated due to unhandled exception in Finalize / Destructor [1514]</title><link>http://sshnet.codeplex.com/workitem/1514</link><description>__My application encountered the following unhandled exception that caused the process to exit&amp;#58;__&lt;br /&gt;&lt;br /&gt;Framework Version&amp;#58; v4.0.30319&lt;br /&gt;Description&amp;#58; The process was terminated due to an unhandled exception.&lt;br /&gt;Exception Info&amp;#58; Renci.SshNet.Common.SshConnectionException&lt;br /&gt;Stack&amp;#58;&lt;br /&gt;  at Renci.SshNet.Session.SendMessage&amp;#40;Renci.SshNet.Messages.Message&amp;#41;&lt;br /&gt;  at Renci.SshNet.Channels.Channel.SendMessage&amp;#40;Renci.SshNet.Messages.Connection.ChannelCloseMessage&amp;#41;&lt;br /&gt;  at Renci.SshNet.Channels.Channel.Close&amp;#40;Boolean&amp;#41;&lt;br /&gt;  at Renci.SshNet.Channels.ChannelSession.Close&amp;#40;Boolean&amp;#41;&lt;br /&gt;  at Renci.SshNet.Channels.Channel.Dispose&amp;#40;Boolean&amp;#41;&lt;br /&gt;  at Renci.SshNet.Channels.ChannelSession.Dispose&amp;#40;Boolean&amp;#41;&lt;br /&gt;  at Renci.SshNet.Sftp.SubsystemSession.Dispose&amp;#40;Boolean&amp;#41;&lt;br /&gt;  at Renci.SshNet.Sftp.SftpSession.Dispose&amp;#40;Boolean&amp;#41;&lt;br /&gt;  at Renci.SshNet.Sftp.SubsystemSession.Finalize&amp;#40;&amp;#41;&lt;br /&gt;&lt;br /&gt;__This occurred just over 60 seconds _after_ the Dispose method on SftpClient was called which generated a very similar exception &amp;#40;handled and logged by my code&amp;#41;&amp;#58;__&lt;br /&gt;&lt;br /&gt;2013-02-16 15&amp;#58;41&amp;#58;32.9693 Error SftpFileTransfer Renci.SshNet.Common.SshConnectionException,Client not connected.,  at Renci.SshNet.Session.SendMessage&amp;#40;Message message&amp;#41;&lt;br /&gt;  at Renci.SshNet.Channels.Channel.SendMessage&amp;#40;ChannelCloseMessage message&amp;#41;&lt;br /&gt;  at Renci.SshNet.Channels.Channel.Close&amp;#40;Boolean wait&amp;#41;&lt;br /&gt;  at Renci.SshNet.Channels.ChannelSession.Close&amp;#40;Boolean wait&amp;#41;&lt;br /&gt;  at Renci.SshNet.Channels.Channel.Dispose&amp;#40;Boolean disposing&amp;#41;&lt;br /&gt;  at Renci.SshNet.Channels.ChannelSession.Dispose&amp;#40;Boolean disposing&amp;#41;&lt;br /&gt;  at Renci.SshNet.Sftp.SubsystemSession.Dispose&amp;#40;Boolean disposing&amp;#41;&lt;br /&gt;  at Renci.SshNet.Sftp.SftpSession.Dispose&amp;#40;Boolean disposing&amp;#41;&lt;br /&gt;  at Renci.SshNet.SftpClient.Dispose&amp;#40;Boolean disposing&amp;#41;&lt;br /&gt;  at Renci.SshNet.BaseClient.Dispose&amp;#40;&amp;#41;&lt;br /&gt;  at BusinessObjects.SftpFileTransfer.DownloadFiles&amp;#40;&amp;#41;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;__It looks like &amp;#126;SubsystemSession&amp;#40;&amp;#41; is causing an attempt to send a message over the channel&amp;#40;&amp;#33;&amp;#41; due to the chaining of calls to the various Dispose&amp;#40;&amp;#41; methods.__&lt;br /&gt;</description><author>olegkap</author><pubDate>Thu, 16 May 2013 12:13:59 GMT</pubDate><guid isPermaLink="false">Closed Issue: Process terminated due to unhandled exception in Finalize / Destructor [1514] 20130516121359P</guid></item><item><title>Closed Issue: Orphaned threads when port forwarding [1522]</title><link>http://sshnet.codeplex.com/workitem/1522</link><description>I&amp;#39;m not sure if this is the same issue as &amp;#91;here&amp;#93;&amp;#40;http&amp;#58;&amp;#47;&amp;#47;sshnet.codeplex.com&amp;#47;workitem&amp;#47;1436&amp;#41;.&lt;br /&gt;&lt;br /&gt;In the situation where a port forward has been established and actively used, therefore a listener thread has been created, if the network is disconnected &amp;#40;by pulling out the cable&amp;#41; and reconnected sometime later then the internal thread will remain there even after everything else has been disposed properly. This causes problems, especially when trying to exit the application since it will hang.&lt;br /&gt;&lt;br /&gt;With a fair amount of Console.WriteLineing it was established that the internal listener thread, consisting mostly of the Bind function in ChannelDirectTcpip, eventually exits its main loop correctly but then stalls at this point forever &amp;#40;well at least until a kill -9 is issued&amp;#41;&amp;#58;&lt;br /&gt;&lt;br /&gt;&amp;#96;&amp;#96;&amp;#96;&lt;br /&gt;System.Threading.WaitHandle.WaitAny&amp;#40;new WaitHandle&amp;#91;&amp;#93; &amp;#123; this._channelEof &amp;#125;&amp;#41;&amp;#59;&lt;br /&gt;&amp;#96;&amp;#96;&amp;#96;&lt;br /&gt;&lt;br /&gt;I do not know much about the inner workings of SSH.NET and therefore do not know the best solution to the problem, but a workaround that seems to do the job for us is to simply allow that wait to timeout&amp;#58;&lt;br /&gt;&lt;br /&gt;&amp;#96;&amp;#96;&amp;#96;&lt;br /&gt;System.Threading.WaitHandle.WaitAny&amp;#40;new WaitHandle&amp;#91;&amp;#93; &amp;#123; this._channelEof &amp;#125;, 5000&amp;#41;&amp;#59;&lt;br /&gt;&amp;#96;&amp;#96;&amp;#96;&lt;br /&gt;&lt;br /&gt;After that, the inner thread exits properly and no more hangs on exit.&lt;br /&gt;</description><author>olegkap</author><pubDate>Thu, 16 May 2013 12:13:59 GMT</pubDate><guid isPermaLink="false">Closed Issue: Orphaned threads when port forwarding [1522] 20130516121359P</guid></item></channel></rss>