0 votes
by (220 points)

Hi,

I am getting NullReferenceException while connecting to SFTP server. This is an intermittent error.

Below is stack trace

    System.NullReferenceException: Object reference not set to an instance of an object.   at swqv.vhtl(EndPoint azc)
   at Rebex.Net.ProxySocket.Connect(EndPoint remoteEP)
   at Rebex.Net.Sftp.fucx(String lz, Int32 ma, SshParameters mb, fflp mc)
   at Rebex.Net.Sftp.fucw(String lw, Int32 lx, SshParameters ly)
   at Rebex.Net.FileTransferClient.Connect(String serverName, Int32 serverPort, FileTransferMode transferMode)

and

System.NullReferenceException: Object reference not set to an instance of an object.   at swqt.kiwp(IPEndPoint jt)
   at swqv.vhtl(EndPoint azc)
   at Rebex.Net.ProxySocket.Connect(EndPoint remoteEP)
   at Rebex.Net.Sftp.fucx(String lz, Int32 ma, SshParameters mb, fflp mc)
   at Rebex.Net.Sftp.fucw(String lw, Int32 lx, SshParameters ly)
   at Rebex.Net.FileTransferClient.Connect(String serverName, Int32 serverPort, FileTransferMode transferMode)

I am sure FileTransferClient object is not null as I am setting a property on this object before calling connect and it does not throw exception from there.

What is the reason for this?

Applies to: Rebex SFTP

1 Answer

0 votes
by (147k points)

A NullReferenceException from inside the Connect method would indicate a bug. However, before we can look into it, please let me know which version of Rebex File Transfer Pack you currently use, and on what platform. Thanks!

by (220 points)
I am using Rebex.FileTransfer version 4.0.6930 on Windows 10 machine.
by (147k points)
Thanks!
The stack trace seems to come from ".NET Standard 1.5" edition of Rebex File Transfer Pack - is this correct? In that case, could you please try using the current version (or the hotfix I sent you earlier today) to see whether the issue still occurs? It is quite possible we have fixed this while implementing support for ".NET Standard 2.0".
And if it does still occur, please let us know which platform you are running on. Rebex ".NET Standard 1.5" binaries support .NET Core 2.x and .NET Core 1.x, but support for other platforms such as .NET Framework 4.6.1/4.7/4.8 has been 'experimental'.
by (220 points)
We are trying this on netcoreapp2.1 and can't update the framework yet. Is .Net Standard 2.0 supported on netcoreapp2.1? I don't think so.

We can update the FileTransferPack version to 5.0.7290.
Will that version have this fix for netcoreapp2.1 framework?
by (147k points)
Yes, .NET Standard 2.0 is supported on .NET Core 2.1 ("netcoreapp2.1").

We believe that FileTransferPack 5.0.7290 no longer suffers from the NullReferenceException issue you reported, although we cannot tell for sure, because this was not a known bug before.
...