Tried this with sendDataAsync, sendDataTaskAsync, and UploadFileTaskAsync, with the same result. When the code comes to `client.UploadFileTaskAsync` will be called and I can see by the `Console.Writeline` that it counts up to the size of the file I'm trying to send very quickly then the program will stand still for a minute and end. I can see that the value of `e.TotalBytesToSend` is always -1. I looked this up in MSDN but can't find anything about the meaning of -1. I tried doing this call with curl and using that I can see in fiddler that the file is being uploaded when curl is counting up the bytes sent so apparently it is possible to get it right, I just don't see how. This is probably related to the similar issue I posted about yesterday when I tried to get progress using `httpwebrequest` https://stackoverflow.com/questions/65391831/showing-file-upload-progress-with-httpwebrequest Here is a minimal program that I can reproduce the issue with. What I have tried: <pre lang="c#">class Program { static async Task Main(string[] args) { using (var client = new WebClient()) { client.UploadProgressChanged += UploadProgressChanged; var result = await client.UploadFileTaskAsync( "https://postman-echo.com/post", "POST", "C:/Dev/Unity/AltspaceVr test word/template.zip"); } } private static void UploadProgressChanged( object sender, UploadProgressChangedEventArgs e) { Console.WriteLine("Sent: " + e.BytesSent + " Total: " + e.TotalBytesToSend); } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)