我有一个它MP3播放器桌面应用程序(.净框架4.7.2)使用ElementHost主办一MediaElement控制和具有DispatcherTimer控制播放(例如更新滑).
一切正常,但是,当我退出应用程序,我得到的 "System.Threading.Tasks.TaskCanceledException: 'A task was canceled.'"
例外(I注意到它只有当下运行调试器).
这是什么,但造成滋扰和感觉主要是无害的,但我不喜欢的例外,我不明白。 该调用栈不是超级有用的:
> 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
这种情况,因为WPF叠不会设置的正确吗? 我保证我DispatchTimer停止在MainForm_FormClosing但也许还有别的东西我需要清理?
不是一个至关重要的问题,当然,通过令人讨厌。