Possible bug when cancelling active WebClient requests via CancelAsync


our App has a screen that request data from a server via a WebClient.DownloadStringAsync() request. When the user navigates away from this screen any outstanding request is cancelled using WebClient.CancelAsync(). It occurs that the App crashes at this cancel request with the following log output:

11-19 12:09:05.359 E/mono (10113):
11-19 12:09:05.359 E/mono (10113): Unhandled Exception:
11-19 12:09:05.359 E/mono (10113): System.Threading.ThreadInterruptedException: Thread interrupted
11-19 12:09:05.359 E/mono (10113): at (wrapper managed-to-native) System.Threading.WaitHandle:WaitOne_internal (System.Threading.WaitHandle,intptr,int,bool)

This crash almost always occurs when starting the App directly, but only rarely (if ever) occurs when executing under the debugger.

I am using Mono for Android 4.2.8 and this crash happens on all of our devices with various Android versions. I am not sure whether this is a known bug that is already fixed in an upcoming version. It might even still be a bug in our App. I just hope that the exception information is helpful to you. Note that this exception occurs on a Mono thread and cannot be caught in our App.

Thanks for your help.

Sign In or Register to comment.