This project is read-only.


Null Exception thrown inside library


Below exception crashes the windows app. Any Ideas what is cause of the problem here.

Application: MyApp.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.NullReferenceException
   at Renci.SshNet.Sftp.SubsystemSession.RaiseError(System.Exception)
   at System.EventHandler`1[[System.__Canon, mscorlib, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089]].Invoke(System.Object, System.__Canon)
   at Renci.SshNet.Session.RaiseError(System.Exception)
   at Renci.SshNet.Session.MessageListener()
   at Renci.SshNet.Session.<Connect>b__4()
   at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
   at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
   at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
   at System.Threading.ThreadPoolWorkQueue.Dispatch()
Closed Sep 17, 2016 at 8:41 AM by drieseng
You should no longer get this exception in version 2016.1.0 (beta1 or higher) of SSH.NET.

If you do, then please submit an issue at our new GitHub home.


jlaustill wrote Sep 26, 2015 at 4:33 AM

I'm running into this exact same situation. It appears to be related to garbage handling as it only happens when I try to create a new object and dispose of the old one for a new connection. I'm working around it by doing a remove port forward and then disconnect then reconnect, which seems to be working. But I would much rather just new up a new object and connect from there. I may have to download the source code tomorrow and see if I can replicate it and find at least the section of code causing the issue.

wrote Mar 17, 2016 at 4:18 AM

abeytr wrote Mar 17, 2016 at 4:22 AM

Any update on this one? Can someone post a workaround pattern to connect and dispose the connections to avoid this error?

wrote Sep 17, 2016 at 8:41 AM