A network folder contain multiple files, with .xml and .jpg extensions.
A VC job contains multiple tasks. 1 of the task contains a FTP download command, and 2 FTP upload commands (1 for *.xml and 1 for *.jpg), to upload files to different folders on a FTPs server.
The task would fail randomly on a *.jpg file - fail to delete source file after uploaded to FTPs server. It would continue to fail on said file in subsequent attempts with the same errors:
Exception in Task: System.Exception: Error uploading file(s): *****.jpg, err: System.IO.IOException: The process cannot access the file '\\***\***.jpg' because it is being used by another process.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.File.InternalDelete(String path, Boolean checkHost)
at VisualCronService.ProcessTaskFTPClass.UploadFTPFilesMulti(ConnectionClientClass cc, FTPCommandClass fc, List`1 files, String destinationpath, Boolean bolDebugging, String& strError) in C:\git\code\VisualCronService\Jobs\TaskProcesses\Net\FTP\clsProcessTaskFTP.vb:line 1831
If uncheck "delete source file after copy" the task runs without errors.
If make a copy of the file, the copy can be uploaded and deleted without issues, but VS reports a null reference error when trying to upload the original file.
Exception in Task: System.Exception: Error preparing upload of FTP folder (2), targetpath: /***/Photos, CurrentPath: , log: 1, error: System.NullReferenceException: Object reference not set to an instance of an object.
at VisualCronService.ProcessTaskFTPClass.PrepareFTPUploadFolder(ConnectionClientClass cc, TElSimpleFTPSClient client, FTPCommandClass fc, String targetpath, Boolean bolDebugging) in C:\git\code\VisualCronService\Jobs\TaskProcesses\Net\FTP\clsProcessTaskFTP.vb:line 4116
On subsequent runs, VC (only dealing with 1 photo to upload) goes back to the IO exception posted at the top.
The file could be deleted manually. I couldn't figure out why the delete would fail. Any thoughts? Thanks.