I am trying to upload a file asynchronously using the WebClient class. I have added event handlers for DownloadProgressChanged and DownloadFileCompleted. If I call client.CancelAsync in the load execution event handler, I get an ObjectDisposedException telling me that the file is closed. How to cancel the download of an asynchronous file?
It turns out that an ObjectDisposedException is thrown, caught, and ignored by the WebClient if the file loads fast enough that progress change events are still processed after the file has been closed.