Quantcast
Channel: sshnet Issue Tracker Rss Feed
Viewing all articles
Browse latest Browse all 1026

Commented Unassigned: NullReferenceException on opening and listen to a ShellStream [2293]

$
0
0
Hello,

i am having the following issue on the newest beta version of Renci.SSHNet 2014.4.6.0

If I try to open a ShellStream on a previously opened SSH Session to an embedded Linux system I am getting the following error:

```
SshNet.Logging Verbose: 1 : SendMessage to server 'ChannelDataMessage': 'SSH_MSG_CHANNEL_DATA : #0'.
SshNet.Logging Verbose: 1 : ReceiveMessage from server: 'ChannelDataMessage': 'SSH_MSG_CHANNEL_DATA : #0'.
SshNet.Logging Verbose: 1 : SendMessage to server 'ChannelDataMessage': 'SSH_MSG_CHANNEL_DATA : #0'.
SshNet.Logging Verbose: 1 : ReceiveMessage from server: 'ChannelDataMessage': 'SSH_MSG_CHANNEL_DATA : #0'.
"TIM LiveLogger.vshost.exe" (CLR v4.0.30319: TIM LiveLogger.vshost.exe): "C:\Windows\Microsoft.Net\assembly\GAC_MSIL\mscorlib.resources\v4.0_4.0.0.0_de_b77a5c561934e089\mscorlib.resources.dll" geladen. Das Modul wurde ohne Symbole erstellt.
Eine Ausnahme (erste Chance) des Typs "System.NullReferenceException" ist in XXXXXXX.exe aufgetreten.
```

I created the session from the main thread by a click on a Windows Forms Button:

```
this.ssh_session = new SshClient(this.host, this.port, this.user, this.password);

this.ssh_session.Connect();

this.shell = ssh_session.CreateShellStream("TEST", 0, 0, 0, 0, 0);

this.shell.DataReceived += new EventHandler<Renci.SshNet.Common.ShellDataEventArgs> his.shell_DataReceived);
this.shell.ErrorOccurred += new EventHandler<Renci.SshNet.Common.ExceptionEventArgs>(this.shell_ErrorOccurred);
```
Comments: ** Comment from web user: bernieserver **

Ok, i found the error. It was my fault.

I forgot to catch an exception inside the DataReceived handler.

My Exception (it was a non - opened filestream to write console output into) was fallen through the whole MessageListener of Renci.SSHNet.

```
private void MessageListener()
{
try
{
while (this._socket != null && this._socket.Connected)
{
var message = this.ReceiveMessage();

if (message == null)
{
throw new NullReferenceException("The 'message' variable cannot be null");
}

this.HandleMessageCore(message);
}
}
catch (Exception exp)
{
// MY EXCEPTION IS FALLEN THROUGH TO HERE!
this.RaiseError(exp);
}
}
```

Thank you!

Regards
Bernhard


Viewing all articles
Browse latest Browse all 1026

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>