Xamarin AppCenter Crashes.TrackError 未显示我在 AppCenter 中期望的详细信息

Ala*_*an2 3 c# xamarin xamarin.forms visual-studio-app-center

我有这个代码:

    private async void ChangeTheColours(Object sender, EventArgs e)
    {
        try
        {
            if ((string)this.ButtonLabel.Text.Substring(0, 1) != " ")
            {
                ConfigureColors((Button)sender, "C");
                await Task.Delay(200);
                ConfigureColors((Button)sender, State);
            }
        }
        catch (Exception ex)
        {
            Crashes.TrackError(ex,
                new Dictionary<string, string> {
                        {"ChangeTheColours", "Exception"},
                        {"Device Name", DeviceInfo.Name },
                        {"Device Model", DeviceInfo.Model },
                });
        }
    }
Run Code Online (Sandbox Code Playgroud)

有一个例外,我希望看到诸如 ex 字符串(超过几个单词)、设备名称和型号等信息。

但AppCenter只告诉我:

堆栈跟踪 Button.ChangeTheColours (System.Object sender, System.EventArgs e) Templates/Button/Button.xaml.cs:83

并且没有提供有关异常或设备名称和型号的更多信息。

我在尝试检测这样的崩溃时是否做错了什么?请注意,我意识到通常需要抛出异常,但这是此错误的特殊情况。

小智 5

夫妇的事情。首先,我认为此页面可能会解释为什么您的异常消息被剪得有点短。我不太确定 125 个字符的限制是否适用于异常本身。

其次,如果不查看各个错误报告,您就看不到太多数据。要查看特定实例 -

  1. 单击左侧导航栏中的“诊断”
  2. 选择您要检查的错误
  3. 在顶部附近,选择“报告”,这会显示带有时间戳的各个实例
  4. 选择实例
  5. 在底部附近,您将看到一个标题为“错误属性”的区域,其中应显示错误中包含的字典数据。