tags:

views:

861

answers:

2

An odd issue that I have been trying to address in a project - my calls to WebClient.DownloadFileAsync seem to be getting ignored and no exceptions are being raised. So far I have been able to determine this might be due to destination folder not existing, but from the looks of the MSDN documentation for Webclient.DownloadFileAsync this should still cause an exception to be raised. I did find one MSDN forum thread that seems to imply that this has been known to happen, but there doesn't seem to be any resolution for it. Any ideas what might be going on?

+1  A: 

In an Async method, Exceptions aren't thrown, but rather passed through to the callback in the EventArgs object.

Ch00k
I put a break point on the function that I assigned to the WebClient.DownloadProgressChanged event and I haven't seen it get raised yet - is there another event that is getting raised?
Rob
+1  A: 

This issue was resolved after reviewing MSDN and the source code involved. Previously the application was only implementing the DownloadProgressChangedEventHandler to track how much of a download remained. This turned out to be the root cause of the issue as AsyncCompletedEventHandler is what is invoked when an exception occurs and not implementing this event handler leaves you with no notification of errors.

Rob