Random TaskAwaiter.ThrowForNonSuccess exception when opening an image

Hello,

I know this control is in preview so please consider this a bug report. Sometimes when I open an image in the editor I get the exception in the title (stack trace below). I am sorry I cannot provide an example as I am unable to duplicate this error consistently, it just happens every now and then in my Android app (I am only doing an Android app, did not test iOS or others). This is the xaml:

<xForms2:SfImageEditor Grid.Column="0" Grid.Row="6" Grid.ColumnSpan="2" 
   x:Name="Editor"
   Source="{Binding ImageSource}">
<xForms2:SfImageEditor.ToolbarSettings>
<xForms2:ToolbarSettings IsVisible="False" />
</xForms2:SfImageEditor.ToolbarSettings>
</xForms2:SfImageEditor>

And the ImageSource is set like this in the view model:

ImageSource = ImageSource.FromStream(() => new MemoryStream(imageByteArrayProperty));

Thanks

Here is the stack trace:
Xamarin caused by: android.runtime.JavaProxyThrowable: System.Threading.Tasks.TaskCanceledException: A task was canceled.
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00026] in <657aa8fea4454dc898a9e5f379c58734>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <657aa8fea4454dc898a9e5f379c58734>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <657aa8fea4454dc898a9e5f379c58734>:0 
  at System.Runtime.CompilerServices.TaskAwaiter`1[TResult].GetResult () [0x00000] in <657aa8fea4454dc898a9e5f379c58734>:0 
  at Xamarin.Forms.StreamImageSource+<Xamarin-Forms-IStreamImageSource-GetStreamAsync>d__5.MoveNext () [0x000f6] in <1aabc0fecdaa41b6a5c04760c77bb648>:0 
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <657aa8fea4454dc898a9e5f379c58734>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0001a] in <657aa8fea4454dc898a9e5f379c58734>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <657aa8fea4454dc898a9e5f379c58734>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <657aa8fea4454dc898a9e5f379c58734>:0 
  at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1+ConfiguredTaskAwaiter[TResult].GetResult () [0x00000] in <657aa8fea4454dc898a9e5f379c58734>:0 
  at Xamarin.Forms.Platform.Android.StreamImagesourceHandler+<LoadImageAsync>d__0.MoveNext () [0x000aa] in <aae4e9ce5a5b4d3eaec4edf21079f3fa>:0 
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <657aa8fea4454dc898a9e5f379c58734>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0001a] in <657aa8fea4454dc898a9e5f379c58734>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <657aa8fea4454dc898a9e5f379c58734>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <657aa8fea4454dc898a9e5f379c58734>:0 
  at System.Runtime.CompilerServices.TaskAwaiter`1[TResult].GetResult () [0x00000] in <657aa8fea4454dc898a9e5f379c58734>:0 
  at Syncfusion.SfImageEditor.XForms.Droid.SfImageEditorRenderer+<GetBitmap>d__6.MoveNext () [0x000b3] in <0f2edfe4610a41dd912a7f834679fed9>:0 
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <657aa8fea4454dc898a9e5f379c58734>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0001a] in <657aa8fea4454dc898a9e5f379c58734>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <657aa8fea4454dc898a9e5f379c58734>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <657aa8fea4454dc898a9e5f379c58734>:0 
  at System.Runtime.CompilerServices.TaskAwaiter`1[TResult].GetResult () [0x00000] in <657aa8fea4454dc898a9e5f379c58734>:0 
  at Syncfusion.SfImageEditor.XForms.Droid.ImageEditorMapping+<setBitmap>d__5.MoveNext () [0x00092] in <0f2edfe4610a41dd912a7f834679fed9>:0 
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <657aa8fea4454dc898a9e5f379c58734>:0 
  at System.Runtime.CompilerServices.AsyncMethodBuilderCore+<>c.<ThrowAsync>b__6_0 (System.Object state) [0x00000] in <657aa8fea4454dc898a9e5f379c58734>:0 
  at Android.App.SyncContext+<>c__DisplayClass2_0.<Post>b__0 () [0x00000] in <848bbd7c681a4975918c72f17d2f5144>:0 
  at Java.Lang.Thread+RunnableImplementor.Run () [0x00008] in <848bbd7c681a4975918c72f17d2f5144>:0 
  at Java.Lang.IRunnableInvoker.n_Run (System.IntPtr jnienv, System.IntPtr native__this) [0x00008] in <848bbd7c681a4975918c72f17d2f5144>:0 
  at (wrapper dynamic-method) System.Object:9e7c32a2-dbb0-492d-96de-084e600cc9c7 (intptr,intptr)
	at mono.java.lang.RunnableImplementor.n_run(Native Method)
	at mono.java.lang.RunnableImplementor.run(RunnableImplementor.java:30)
	at android.os.Handler.handleCallback(Handler.java:739)
	at android.os.Handler.dispatchMessage(Handler.java:95)
	at android.os.Looper.loop(Looper.java:148)
	at android.app.ActivityThread.main(ActivityThread.java:5417)
	at java.lang.reflect.Method.invoke(Native Method)
	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)

1 Reply

AK Ashwin Kumaravel Syncfusion Team February 12, 2018 09:59 AM UTC

Hi Jose

Sorry for the inconvenience,

We can reproduce the reported exception “A task was canceled" at our end. We have already logged bug report for the same.
The fix will be included in our upcoming 2018 Volume 1 main release which is expected to be rolled out by the mid of February 2018.

Regards,
Ashwin


Loader.
Up arrow icon