Eu tenho um WinForms leitor de MP3 aplicativo da área de trabalho (.NET Framework 4.7.2) que está a utilizar ElementHost para hospedar um MediaElement de controle e tem um DispatcherTimer para controlar a reprodução (como atualizar um controle Deslizante).
Tudo funciona bem, mas quando eu sair do app, recebo a "System.Threading.Tasks.TaskCanceledException: 'A task was canceled.'"
exceção (eu aviso-a apenas quando executando sob o depurador).
Não é nada, mas um incômodo e se sente o mais inofensivo, mas eu não gosto de exceções que eu não entendo. A pilha de chamadas não é super útil:
> mscorlib.dll!System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(System.Threading.Tasks.Task task) Unknown
mscorlib.dll!System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(System.Threading.Tasks.Task task) Unknown
WindowsBase.dll!System.Windows.Threading.DispatcherOperation.Wait(System.TimeSpan timeout) Unknown
WindowsBase.dll!System.Windows.Threading.Dispatcher.InvokeImpl(System.Windows.Threading.DispatcherOperation operation, System.Threading.CancellationToken cancellationToken, System.TimeSpan timeout) Unknown
WindowsBase.dll!System.Windows.Threading.Dispatcher.Invoke(System.Action callback, System.Windows.Threading.DispatcherPriority priority, System.Threading.CancellationToken cancellationToken, System.TimeSpan timeout) Unknown
WindowsBase.dll!MS.Internal.WeakEventTable.OnShutDown() Unknown
WindowsBase.dll!MS.Internal.WeakEventTable.WeakEventTableShutDownListener.OnShutDown(object target, object sender, System.EventArgs e) Unknown
WindowsBase.dll!MS.Internal.ShutDownListener.HandleShutDown(object sender, System.EventArgs e) Unknown
Isso está acontecendo porque o WPF pilha não obter descartados corretamente, de alguma forma? Eu garantir a minha DispatchTimer está parado no MainForm_FormClosing mas, talvez, há algo mais que eu precise limpar?
Não é uma questão crítica, é claro, por irritante.