Hoh, yes sorry... Running the four lines I posted I get this back:
Unhandled Exception: System.Threading.ThreadInterruptedException: Thread interrupted at (wrapper managed-to-native) System.Threading.WaitHandle:WaitOne_internal (System.Threading.WaitHandle,intptr,int,bool) at System.Threading.WaitHandle.WaitOne (Int32 millisecondsTimeout, Boolean exitContext) [0x00000] in <filename unknown>:0 at System.Net.WebAsyncResult.WaitUntilComplete (Int32 timeout, Boolean exitContext) [0x00000] in <filename unknown>:0 at System.Net.HttpWebRequest.EndGetResponse (IAsyncResult asyncResult) [0x00000] in <filename unknown>:0 at System.Net.HttpWebRequest.GetResponse () [0x00000] in <filename unknown>:0 at System.Net.WebClient.GetWebResponse (System.Net.WebRequest request) [0x00000] in <filename unknown>:0 at System.Net.WebClient.ReadAll (System.Net.WebRequest request, System.Object userToken) [0x00000] in <filename unknown>:0 at System.Net.WebClient.DownloadDataCore (System.Uri address, System.Object userToken) [0x00000] in <filename unknown>:0 [ERROR] FATAL UNHANDLED EXCEPTION: System.Threading.ThreadInterruptedException: Thread interrupted at (wrapper managed-to-native) System.Threading.WaitHandle:WaitOne_internal (System.Threading.WaitHandle,intptr,int,bool) at System.Threading.WaitHandle.WaitOne (Int32 millisecondsTimeout, Boolean exitContext) [0x00000] in <filename unknown>:0 at System.Net.WebAsyncResult.WaitUntilComplete (Int32 timeout, Boolean exitContext) [0x00000] in <filename unknown>:0 at System.Net.HttpWebRequest.EndGetResponse (IAsyncResult asyncResult) [0x00000] in <filename unknown>:0 at System.Net.HttpWebRequest.GetResponse () [0x00000] in <filename unknown>:0 at System.Net.WebClient.GetWebResponse (System.Net.WebRequest request) [0x00000] in <filename unknown>:0 at System.Net.WebClient.ReadAll (System.Net.WebRequest request, System.Object userToken) [0x00000] in <filename unknown>:0 at System.Net.WebClient.DownloadDataCore (System.Uri address, System.Object userToken) [0x00000] in <filename unknown>:0 Rolf Bjarne Kvinge wrote > > Hi, > > On Mon, Apr 16, 2012 at 10:45 AM, victoria <iminurbase@> wrote: > >> Hello list, >> >> I'm not sure if this is a Monotouch bug or if we're doing something wrong >> here. We're trying to use System.Net.WebClient to fetch some data async >> with >> a nice optional "Cancel this download" button for the user - however >> trying >> to cancel the request blows up everything. Behold: >> > > Can you be a bit more specific than "blows up everything"? Is an exception > thrown? Is anything printed to the application output / console? Any crash > reports? > > Rolf > > >> >> // random somewhat big file to not download >> string file = >> "http://www.kernel.org/pub/linux/kernel/v2.0/linux-2.0.1.tar.bz2"; >> >> WebClient client = new WebClient(); >> client.DownloadDataAsync(new Uri(file)); >> client.CancelAsync(); // kaboom >> >> The code above works just fine on .NET/Windows - also, changing >> DownloadDataAsync to DownloadStringAsync seems to work as we would expect >> it >> to (no kaboom, but we need the raw data so unfortunately we can't use it) >> >> Thoughts? Bug? Help? >> >> / V >> >> -- >> View this message in context: >> http://monotouch.2284126.n4.nabble.com/CancelAsync-on-DownloadDataAsync-crashes-monotouch-tp4560900p4560900.html >> Sent from the MonoTouch mailing list archive at Nabble.com. >> _______________________________________________ >> MonoTouch mailing list >> [email protected] >> http://lists.ximian.com/mailman/listinfo/monotouch >> > > _______________________________________________ > MonoTouch mailing list > [email protected] > http://lists.ximian.com/mailman/listinfo/monotouch > -- View this message in context: http://monotouch.2284126.n4.nabble.com/CancelAsync-on-DownloadDataAsync-crashes-monotouch-tp4560900p4561577.html Sent from the MonoTouch mailing list archive at Nabble.com. _______________________________________________ MonoTouch mailing list [email protected] http://lists.ximian.com/mailman/listinfo/monotouch
