Open trinnan42 opened 3 weeks ago
Thanks for this input.
I have made some initial changes to take the IsFailed() fact, just as you suggested, and merged those changes. Perhaps you could try out the current master instead of Nuget and we can take this from there to see if we can percolate the failure reason into the FtpResult as a next step.
Note that I can find "550 Device Function Code invalid" in Google - especially in FANUC and Robotics contexts, just as an aside.
Despite the failure, we're not seeing the IsFailed flag as true in the FtpResult object.
I feel that IsFailed is sort of redundant, in that IsFailed is in effect <---- not IsSuccess and not IsSkipped, but I suppose it is included more or less for completeness.
I feel that IsFailed is sort of redundant, in that IsFailed is in effect <---- not IsSuccess and not IsSkipped, but I suppose it is included more or less for completeness.
Yeah that makes sense. My concern was that we were also seeing some situations where we were successfully copying but not getting the IsSuccess flag (nor any other flag). I'll need to look into that some more though, because later I was getting the IsSuccess flag. Not sure yet if we can recreate it or not...
We're working on testing with the current master.
We tested with those changes and we are now getting IsSuccess and IsFailed as expected.
see if we can percolate the failure reason into the FtpResult as a next step.
That would be great!
@trinnan42
I just realised that there might already be a nice way for you to check "what happened". About a year or even longer ago, I put a property into the client called
/// <summary> Gets the last replies received from the server</summary>
public List<FtpReply> LastReplies { get; set; }
This will supply you with the last 5 FtpReply
s. You should be able to see a 5xx and text et al.
I think, at the time, I needed more information myself in an application I was coding - especially as sometimes a failure message may be preceeded by more information (otherwise lost).
Could we assign the LastReply
to an FtpReply
property of each FtpResult
?
If we only have the LastReply
and LastReplies
properties, I think we would need to write some logic to determine how to associate the replies with each file we're uploading/downloading. Especially since we're also now using the UploadDirectory
and DownloadDirectory
methods so at the moment we don't have a list on our end of the files we're intending to copy. (Speaking of: will the changes for populating the IsFailed
property on FtpResult
be reflected in those.)
I appreciate your time helping us out here and I would be willing to do a PR to make these changes if you want. Thanks!
Could we assign the LastReply to an FtpReply property of each FtpResult?
Oops, my bad. I totally forgot that we are populating this list. And yes, one would need to add the LastReplies list to the FtpReply list.
I think I also want to investigate passing other errors (beyond FTP server error replies) up to the top. Think of I/O errors, timeouts and so on.
So my previous suggestions was simply premature and born out of over-enthusiasm.
would be willing to do a PR to make these changes
Always appreciated. But let's find the most beautiful way do fix this first.
I've been playing around with the current code (with our recent addition).
Look - failures should be found in the Exception
field of the FtpResult
.
550 Device Function Code invalid
as response would also cause such a result. The problem seems to be that a verification is subsquently performed, whose failure masks the previous failure.
Need to look at that in more detail.
Can you also check what I mentioned in my last post?
FTP Server OS: Windows
FTP Server Type: The FTP server is running on FANUC R-30iB/R-30iB+ Robot Controllers. I'm not sure about what exactly our FTP server is, but my best guess is that it's a custom FTP implementation.
Client Computer OS: Windows
FluentFTP Version: 51.1.0
Framework: .NET 8
We're attempting to upload a set of files to our Robot Controller using the
UploadFiles
method on theAsyncFtpClient
. We are using the returned list ofFtpResult
instances to determine whether each file was successful or not with theIsSuccess
andIsFailed
flags. In the Fluent FTP logging we're seeing that the file failed to upload due with error code 550 "Device Function Code invalid". Despite the failure, we're not seeing theIsFailed
flag as true in theFtpResult
object.Looking into the source code, it looks like the IsFailed flag only gets set to true if an exception occurs and the
FtpStatus.Failed
result we were returned from theUploadFileFromFile
method is not reflected in the FtpResult if it fails.Would something like this make sense to do?
UploadFiles.cs ->
AsyncFtpClient.UploadFiles
-> Line 99I'd also like to have the information of why the file failed top copy, in this case the 550 error
Logs :
[Edited to remove some private information]
To give a little more information, we don't have a problem with the FTP process itself. I believe our Robot Controller is denying this file to be copied for a legitimate reason. We are able to successfully download and upload other legitimate files. Our concern is only with the reporting so that we can display why things failed: display the 550 error, etc.
If you need any additional information, please let me know. Thanks!