I'm using MVVM cross in my application. I face System.Threading.Tasks.TaskCanceledException Message=A task was canceled in this part of the code.
public override void ViewDestroy(bool viewFinishing = true) { if (viewFinishing && CloseCompletionSource != null && !CloseCompletionSource.Task.IsCompleted && !CloseCompletionSource.Task.IsFaulted) { CloseCompletionSource?.TrySetCanceled(); } base.ViewDestroy(viewFinishing); }
This exception raises only some times but not all the time.
Answers
TrySetCanceled
method may leadTaskCanceledException
.Check the detailed explanation : https://stackoverflow.com/a/43681980/8187800 .