System.Threading.Tasks.TaskCanceledException will crash the application
See original GitHub issueHey, I am facing a problem in my Xamarin.Forms Android Application. I am using the current Nuget Package. In my application I have the imagecontrol used in a TelerikListview. Sometimes when I scroll through the Listview I get the following Exception and the Application crashs:
03-15 11:10:38.518 I/MonoDroid( 3392): UNHANDLED EXCEPTION: 03-15 11:10:38.519 I/MonoDroid( 3392): System.Threading.Tasks.TaskCanceledException: A task was canceled. 03-15 11:10:38.519 I/MonoDroid( 3392): at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0002d] in /Users/builder/data/lanes/4009/f3074d2c/source/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:179 03-15 11:10:38.519 I/MonoDroid( 3392): at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x0002e] in /Users/builder/data/lanes/4009/f3074d2c/source/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:156 03-15 11:10:38.519 I/MonoDroid( 3392): at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x0000b] in /Users/builder/data/lanes/4009/f3074d2c/source/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:128 03-15 11:10:38.519 I/MonoDroid( 3392): at System.Runtime.CompilerServices.ConfiguredTaskAwaitable
1+ConfiguredTaskAwaiter[TResult].GetResult () [0x00000] in /Users/builder/data/lanes/4009/f3074d2c/source/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:535
03-15 11:10:38.519 I/MonoDroid( 3392): at FFImageLoading.Work.ImageLoaderTask2+<<Init>b__3_0>d[TImageContainer,TImageView].MoveNext () [0x00057] in C:\projects\ffimageloading\source\FFImageLoading.Common\Work\ImageLoaderTask.cs:40 03-15 11:10:38.519 I/MonoDroid( 3392): --- End of stack trace from previous location where exception was thrown --- 03-15 11:10:38.519 I/MonoDroid( 3392): at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /Users/builder/data/lanes/4009/f3074d2c/source/mono/mcs/class/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:143 03-15 11:10:38.519 I/MonoDroid( 3392): at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00027] in /Users/builder/data/lanes/4009/f3074d2c/source/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:176 03-15 11:10:38.519 I/MonoDroid( 3392): at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x0002e] in /Users/builder/data/lanes/4009/f3074d2c/source/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:156 03-15 11:10:38.519 I/MonoDroid( 3392): at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x0000b] in /Users/builder/data/lanes/4009/f3074d2c/source/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:128 03-15 11:10:38.519 I/MonoDroid( 3392): at System.Runtime.CompilerServices.ConfiguredTaskAwaitable+ConfiguredTaskAwaiter.GetResult () [0x00000] in /Users/builder/data/lanes/4009/f3074d2c/source/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:447 03-15 11:10:38.519 I/MonoDroid( 3392): at FFImageLoading.Work.ImageLoaderTask
2+<Init>d__3[TImageContainer,TImageView].MoveNext () [0x00075] in C:\projects\ffimageloading\source\FFImageLoading.Common\Work\ImageLoaderTask.cs:38
03-15 11:10:38.519 I/MonoDroid( 3392): — End of stack trace from previous location where exception was thrown —
03-15 11:10:38.519 I/MonoDroid( 3392): at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /Users/builder/data/lanes/4009/f3074d2c/source/mono/mcs/class/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:143
03-15 11:10:38.519 I/MonoDroid( 3392): at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00027] in /Users/builder/data/lanes/4009/f3074d2c/source/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:176
03-15 11:10:38.519 I/MonoDroid( 3392): at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x0002e] in /Users/builder/data/lanes/4009/f3074d2c/source/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:156
03-15 11:10:38.519 I/MonoDroid( 3392): at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x0000b] in /Users/builder/data/lanes/4009/f3074d2c/source/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:128
03-15 11:10:38.519 I/MonoDroid( 3392): at System.Runtime.CompilerServices.TaskAwaiter.GetResult () [0x00000] in /Users/builder/data/lanes/4009/f3074d2c/source/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:113
03-15 11:10:38.519 I/MonoDroid( 3392): at FFImageLoading.Work.WorkScheduler+<LoadImage>d__44.MoveNext () [0x0022e] in C:\projects\ffimageloading\source\FFImageLoading.Common\Work\WorkScheduler.cs:163
03-15 11:10:38.519 I/MonoDroid( 3392): — End of stack trace from previous location where exception was thrown —
03-15 11:10:38.519 I/MonoDroid( 3392): at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /Users/builder/data/lanes/4009/f3074d2c/source/mono/mcs/class/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:143
03-15 11:10:38.519 I/MonoDroid( 3392): at System.Runtime.CompilerServices.AsyncMethodBuilderCore.<ThrowAsync>m__0 (System.Object state) [0x00000] in /Users/builder/data/lanes/4009/f3074d2c/source/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/AsyncMethodBuilder.cs:1018
03-15 11:10:38.519 I/MonoDroid( 3392): at Android.App.SyncContext+<Post>c__AnonStorey0.<>m__0 () [0x00000] in /Users/builder/data/lanes/4009/9578cdcd/source/xamarin-android/src/Mono.Android/Android.App/SyncContext.cs:35
03-15 11:10:38.519 I/MonoDroid( 3392): at Java.Lang.Thread+RunnableImplementor.Run () [0x0000b] in /Users/builder/data/lanes/4009/9578cdcd/source/xamarin-android/src/Mono.Android/Java.Lang/Thread.cs:36
03-15 11:10:38.519 I/MonoDroid( 3392): at Java.Lang.IRunnableInvoker.n_Run (System.IntPtr jnienv, System.IntPtr native__this) [0x00009] in /Users/builder/data/lanes/4009/9578cdcd/source/monodroid/src/Mono.Android/platforms/android-23/src/generated/Java.Lang.IRunnable.cs:81
03-15 11:10:38.519 I/MonoDroid( 3392): at (wrapper dynamic-method) System.Object:eac2b394-0725-46b6-998d-94d98e08006b (intptr,intptr)
03-15 11:10:38.521 W/art ( 3392): JNI RegisterNativeMethods: attempt to register 0 native methods for android.runtime.JavaProxyThrowable
03-15 11:10:38.522 D/Mono ( 3392): DllImport searching in: ‘__Internal’ (‘(null)’).
03-15 11:10:38.522 D/Mono ( 3392): Searching for ‘java_interop_jnienv_throw’.
03-15 11:10:38.522 D/Mono ( 3392): Probing ‘java_interop_jnienv_throw’.
03-15 11:10:38.522 D/Mono ( 3392): Found as ‘java_interop_jnienv_throw’.
An unhandled exception occured.
03-15 11:10:39.195 E/mono ( 3392): 03-15 11:10:39.195 E/mono ( 3392): Unhandled Exception: 03-15 11:10:39.195 E/mono ( 3392): System.Threading.Tasks.TaskCanceledException: A task was canceled. 03-15 11:10:39.195 E/mono-rt ( 3392): [ERROR] FATAL UNHANDLED EXCEPTION: System.Threading.Tasks.TaskCanceledException: A task was canceled. 03-15 11:10:39.195 W/art ( 3392): Native thread exiting without having called DetachCurrentThread (maybe it’s going to use a pthread_key_create destructor?): Thread[21,tid=3419,Native,Thread*=0x94df3300,peer=0x12e950a0,“Thread-218”] `
Issue Analytics
- State:
- Created 7 years ago
- Comments:5 (2 by maintainers)
Top GitHub Comments
This is fixed by @AndreiMisiukevich PR. However as described in my comment, here: https://github.com/luberda-molinet/FFImageLoading/pull/529#issuecomment-286757230 It would be better to have a global look on the
async void
usage.I tried to fix this issue in my PR https://github.com/luberda-molinet/FFImageLoading/pull/529 It include fix for this crash