|
-
Mar 27th, 2020, 12:54 PM
#6
Re: DownloadFileAsync not so Async
I'd be very surprised if call(s) to DownLoadFileAsync caused the UI to freeze. I think the problem is much more likely to be found in code you haven't shown, or in the way you are using the code that you have shown here.
You say you might download up to 300 images. So are you looping the second block of code? I ask because the lines:
Code:
Dim Request As HttpWebRequest = WebRequest.Create(New Uri(uriString))
Dim JSON_Response As String = New StreamReader(Request.GetResponse().GetResponseStream()).ReadToEnd()
are not Async, and will freeze the UI while the web request is negotiated and the JSON is downloaded from the server. Do that once and you'd hardly notice. Doing it 300 times in a loop however, would be a big problem.
While running you code from the IDE, try pressing the pause button (or Debug menu/ Break All) at the point that the UI freezes. The line of code that is blocking execution or is part of a long running loop should be highlighted. Doesn't always work, but is worth a try.
Last edited by Inferrd; Mar 27th, 2020 at 12:57 PM.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|