Friday 15 May 2015

c# - What line(s) this code might throw a "Index was outside the bounds of the array" exception? -


A small background of this error: the customer is able to obtain this error message in his log file and reproduce the support Is not it yet? That's why I am trying to determine what may be happening. I reviewed my log file and restricted it to this section of code I had not written this code, but the purpose of this is to FTP a ZIP file on the remote server. The question is ....

What is the line that was outside the range of the "index" array? exception?

  FtpLib.FTPFactoryFF = new FTPLB FTPPFF (); Try {ff.setRemoteHost (job.FTPHost); Ff.setRemoteUser (job.FTPUser); Ff.setRemotePass (job.FTPPW); Ff.login (); // Various additional commands executed in foreach (string command in job.Commands) {if (log.IsDebugEnabled) logs. Debug ("JOB:" + job.ID + "- FTP command \" + command + "\" sent ... "); Ff.sendCommand (order); If log (enable .sdbues) log Debug ("JOB:" + job.ID + "- Response:" + ff.getLastMessage ()); } Try {{Ff.mkdir (job.FTPRemoteDir); } Hold (IOException) {} ff.chdir (job.fTPRemoteDir); Ff.setBinaryMode (true); If (log.IsInfoEnabled) log.Info ("JOB:" + job.ID + "- FTP upload: \" "+ zipfile.Name +" \ "to \" "+ job.FTPHost +" / "+ job .FTPRemoteDir + "/ \" "); Ff.upload (zipfile.FullName); If (log.IsInfoEnabled) log.Info ("JOB:" + job.ID + "- full"); BFTPSuccess = true; break; thank you in advanced! 

Update: I think we all very much agree that the problem is going to be in FTPLib, I will see that we have its source. I came to know that this is a vague bug, the customer can not be constantly reproduced, so it will be a fun pin pin. I've added extra debug logging using the exception. StackTrace and Exception After the toothstring function is resolved, I will update once more and try to give the correct answer with the right person, although everyone has given good suggestions. Thanks for the help!

I recommend that you log in with the exception. StackTrace at the point where you are currently holding boundary exceptions. Exception. ToString () is also very useful, because it gives most important information. This will tell you the exact location where the exception is being thrown (without guessing). However, be careful of that code, which spreads and hides exception - I think that the code you post has "hold (IOE expansion) {}" in addition to being careful of code which spreads the exception and then a different Throw an exception, which will hide the original error.

There should be no need to wrap in the effort ... Grab the personal lines which are suspicious - as long as any exceptions are logged and logged on to a point in the series.


No comments:

Post a Comment