Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
0 votes
6.8k views
in .NET FTP by (200 points)
Hi,

(Great component, thanks for the Freebie!)

I get a NullReferenceException when the file does not exist. Having quickly looked through the source and even attached the src project and debugged,
an FTPException is obviously what I should be getting and is what is thrown when I step through the edtFTP src. But via the Finally it looks like something is broken.

Sample code and stack trace below.

Output:
A first chance exception of type 'EnterpriseDT.Net.Ftp.FTPException' occurred in edtFTPnet.DLL
A first chance exception of type 'EnterpriseDT.Net.Ftp.FTPException' occurred in edtFTPnet.DLL
A first chance exception of type 'EnterpriseDT.Net.Ftp.FTPException' occurred in edtFTPnet.DLL
A first chance exception of type 'System.NullReferenceException' occurred in edtFTPnet.DLL

public byte[] GetFileData(PathInfo pathInfo)
{
byte[] data = null;
using (FTPConnection conn = GetConnection(pathInfo))
{
try
{
conn.ChangeWorkingDirectory(pathInfo.Directory);
data = conn.DownloadByteArray(pathInfo.Filename);
return data;
}
catch (FTPException ex)
{

}
return data;
}
}


System.NullReferenceException was unhandled
Message=Object reference not set to an instance of an object.
Source=edtFTPnet
StackTrace:
at EnterpriseDT.Net.Ftp.FTPConnection.OnDownloaded(Byte[] bytes, String remoteFile, Int64 bytesTransferred, Exception ex, Int64 remoteFileSize, DateTime remoteModTime)
at EnterpriseDT.Net.Ftp.FTPConnection.DownloadByteArray(String remoteFile)
at A.ClientLibrary.FileManagement.FTPFileManager.GetFileData(PathInfo pathInfo) in C:\Development\Projects\FileManager.cs:line 269
at A.ClientLibrary.FileManagement.FileManager.GetFileData(String path) in C:\Development\Projects\FileManager.cs:line 39
at A.Program.Main(String[] args) in C:\Development\Test\MockGenClientLibraryTest\Program.cs:line 20
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException:

7 Answers

0 votes
by (162k points)
I think that's a bug we've fixed recently. Email support@... for the latest build (not yet released).
0 votes
by (162k points)
Actually the fix I'm thinking of is in the latest release, 2.2.2. Are you using it?

If not, upgrade. If you are please send us a log file at the Debug level.
0 votes
by (200 points)
Running 2.2.2.

Log emailed, just looks like there is an issue with code in OnDownloaded if there was a preceeding exception.

You should be able to replicate it very easily - try downloading a file that doesn't exist.

Cheers,
Tim
0 votes
by (162k points)
Have emailed you a fix.
0 votes
by (200 points)
Thanks Bruce, excellent support.
0 votes
by (140 points)
Have emailed you a fix.


I also have the same problem. Could I also get the fix?

When will you launch a release that fixes the bug?
0 votes
by (162k points)
Sure, please email us. We'll release a new version of edtFTPnet in the next week or so.

Categories

...