Topic "System.AggregateException"

Author Message


I'm getting a System.AggregateException at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification) with the following code (passwords and paths omitted):


SessionOptions sessionOptions = new SessionOptions
   Protocol = Protocol.Sftp,
   HostName = "",
   UserName = "",
   Password = "",
   SshHostKeyFingerprint = ""

using (Session session = new WinSCP.Session())

   TransferOptions transferOptions = new TransferOptions()
      TransferMode = TransferMode.Automatic

   IEnumerable<RemoteFileInfo> files = session.EnumerateRemoteFiles("", "*.xml", EnumerationOptions.None);

   string localDir = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName());

   foreach (RemoteFileInfo file in files)
      string localFile = Path.Combine(localDir, file.Name);
      TransferOperationResult transferResult = session.GetFiles(file.FullName, localFile, false, transferOptions);

      if (transferResult.IsSuccess) //Exception thrown


What could be causing this? Thanks for the assistance.
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 26331
Location: Prague, Czechia
Show us a full exception callstack, any inner exceptions (including callstacks) and debug log (Session.DebugLogPath).

You can post new topics in this forum

Search Site

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!


About donations

$9   $19   $49   $99

About donations


WinSCP Privacy Policy

WinSCP License