Xamarin.Android 异步方法中没有堆栈跟踪

Xamarin.Android no stack trace in async method

有人可能找到了解决此错误的方法:

https://bugzilla.xamarin.com/show_bug.cgi?id=30513

?

这让我发疯...屏幕截图是我从异步方法获得的异常报告。

伙计们,我已经找到了这个错误的解决方法,这里是逐步处理它并让 Xamarin.Insights 工作的方法。

  1. 将文本文件添加到Android项目(名称无关紧要)并设置它 从属性中的 "Content" 到“AndroidEnvironment
  2. 在您创建的文本文件中添加该标志: XA_BROKEN_EXCEPTION_TRANSITIONS=true - 这个标志意味着我们将使用旧的,Xamarin.Android 4.x 异常处理
  3. 然后在你的 droid 项目中添加 android 异常全局处理程序,它将处理 Android 异常,这些异常通常会在你的 Xamarin.Insights(或其他报告工具)能够做一些工作。

AndroidEnvironment.UnhandledExceptionRaiser += (sender, args) => { args.Handled = true; }

瞧,Xamarin.Insights 已准备好为您服务:)

这是另一个对我有用的解决方案。 只需在您的应用程序或主 Activity

中添加此处理程序
AndroidEnvironment.UnhandledExceptionRaiser += delegate(object sender, RaiseThrowableEventArgs args){
            typeof (System.Exception).GetField("stack_trace", BindingFlags.NonPublic | BindingFlags.Instance)
                .SetValue(args.Exception, null);
            throw args.Exception;
        };

解释在最后posthttps://forums.xamarin.com/discussion/45219/stack-trace-not-captured-properly