Nope - this does not work under load on an iPad 1.
Thanks,
Rick
On Aug 24, 2011, at 12:38 PM, Gonzalo Paniagua [via MonoTouch] wrote:
> - Hide quoted text -
> On Thu, Aug 18, 2011 at 3:51 PM, Miguel de Icaza <[hidden email]> wrote:
>
> > Hello,
> >
> >> I have this code running on both iPad 1 and 2's. On the iPad 1 the code
> >> hangs
> >> at random points getting files. On a 2 it works 100% of the time. Any
> >> thoughts would be appreciated.
> >>
> >> WebClient wc = new WebClient();
> >> Uri uri = new Uri(url);
> >> byte[] bytes = wc.DownloadData(uri);
> >>
> >> string path = Path.Combine(tmpPath, fileName);
> >>
> >> File.WriteAllBytes(path, bytes);
> >> wc.Dispose();
> >
> > We just fixed this problem. Gonzalo (CCed on this line) might be able to
> > provide a temporary workaround to use for this scenario.
>
> When the problem occurs, "kicking" the threadpool by adding another
> work item will make the problem go away.
>
> Something like this (not tested or compiled ;-) should do:
> ################################################
> Timer timer = new Timer (AddMe);
> ...
> WebClient wc = new WebClient ();
> Uri uri = new Uri(url);
> timer.Change (0, 500); // Trigger it now and every 500ms
> byte[] bytes = wc.DownloadData(uri);
> timer.Change (Timeout.Infinite, Timeout.Infinite);
> ....
> static void AddMe (object state)
> {
> // Empty.
> }
> ################################################
>
>
> -Gonzalo
> _______________________________________________
> MonoTouch mailing list
> [hidden email]
> http://lists.ximian.com/mailman/listinfo/monotouch
>
>
> If you reply to this email, your message will be added to the discussion
> below:
> http://monotouch.2284126.n4.nabble.com/Difference-between-iPad-1-and-iPad-2-with-WebClient-tp3750957p3766401.html
> To unsubscribe from Difference between iPad 1 and iPad 2 with WebClient,
> click here.
--
View this message in context:
http://monotouch.2284126.n4.nabble.com/Difference-between-iPad-1-and-iPad-2-with-WebClient-tp3750957p3766744.html
Sent from the MonoTouch mailing list archive at Nabble.com._______________________________________________
MonoTouch mailing list
[email protected]
http://lists.ximian.com/mailman/listinfo/monotouch