Uwp应用程序因错误而崩溃-“应用程序崩溃-参数不正确”

时间:2020-10-28 09:54:06

标签: uwp crash

我有一个聊天应用程序,当我滚动到顶部的消息时,它经常崩溃。

private async Task ScrollIntoViewWithDelayAsync(int message)
    {
        await DispatcherHelper.ExecuteOnUIThreadAsync(async () =>
        {
            try
            {
                if (MessageList != null && MessageList.Count > 0 )
                {
                    ObjFactory.Instance.CreateLogger().Log("ScrollIntoViewWithDelayAsync Start", GetType().Name, false);

                    await Task.Delay(100);
                    if (message > -1 && message < MessageList.Count)
                    {                           
                        _messageListView?.ScrollIntoView(MessageList[message], ScrollIntoViewAlignment.Leading);
                    }
                    ObjFactory.Instance.CreateLogger().Log("ScrollIntoViewWithDelayAsync End", GetType().Name, false);
                }
            }
            catch (Exception ex)
            {
                ObjFactory.Instance.CreateLogger().Log("EX= " + ex.Message, GetType().Name);
            }
        });
    }

我无法确切找出原因。但是在大多数情况下,它停留在此代码中,因为在日志中,它仅显示“ ScrollIntoViewWithDelayAsync Start”

0 个答案:

没有答案