TransferProgressChanged event is triggered exactly 10 times everytime

0 votes
asked Sep 9, 2019 by jcmiron (120 points)

In our dotnet core application, we subscribe to the TransferProgressChanged event, but it triggers many TransferProgressState.FileTransferring events. Almost exactly 10 time each time. We are able to get the TransferProgressState.TransferCompleted to trigger once, but we can't seem to get an equivalent for transfer started. Why would the file transferring trigger 10 times for each file?

1 Answer

0 votes
answered Sep 10, 2019 by Lukas Matyska (59,010 points)

Can you please provide us with a small code which reproduce the issue?
I have tried it for myself and it is working as expected (FileTransferring event is triggered once for each file).
I tried this:

var client = new Sftp();
client.Login("demo", "password");

client.TransferProgressChanged += (s, e) =>
    switch (e.TransferState)
        case TransferProgressState.FileTransferring:
            Console.WriteLine("FileTransferring: {0}", e.TargetPath);
        case TransferProgressState.FileTransferred:
            Console.WriteLine("FileTransferred: {0}", e.TargetPath);
        case TransferProgressState.TransferCompleted:
            Console.WriteLine("TransferCompleted: {0}", e.TargetPath);

client.Download("*", "c:/temp", 0, 0, ActionOnExistingFiles.OverwriteAll);