我的UWP应用程序有时会崩溃。并且根本无法进行调试。 现在,我找到了一些信息。
首先,EventViewer显示信息。 (抱歉,全部是日语。但重要信息仅为#34; Windows.UI.Xaml.dll"异常代码为0xc0000005。
Next is this information.。我的程序也在dispatcher.RunAsync中崩溃。我确信这条线路因我的日志记录而崩溃。
dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => action()).AsTask();
在我的Dispatcher.RunAsync中。我用了
private EventHandler<object> eh = null;
"in dispatcher.RunAsync"
DispatcherTimer dtimer = new DispatcherTimer();
eh = async (sender, e) => await WhenTimerStop(sender, new A_SwitchEvent());
dtimer.Tick += eh;
dtimer.Start();
问题
我不应该在dispatcher.RunAsync中使用DispatcherTimer吗? 如何使用DispatcherTimer?我没有知识。如果没有在UI线程上运行,DispatcherTimer会导致错误。然后我使用了Dispatcher.RunAsync。
在我的计时器中,我没有触摸UI。我应该使用其他计时器吗?在UWP中推荐什么?