gpt4 book ai didi

c# - 带有行号的 Xamarin Insights

转载 作者:太空狗 更新时间:2023-10-29 14:03:03 24 4
gpt4 key购买 nike

我发布了一款使用 Xamarin 和 Xamarin Insights 的应用。现在,当应用程序崩溃时,Insights 会成功地通知我,但我只得到一个非常模糊的堆栈跟踪没有行号,这使得通常无法追踪错误。

有什么方法可以设置发布版本,以便崩溃将包含堆栈跟踪(包括行号)?

谢谢, 大卫

最佳答案

引用:Why don't I have line numbers in my stack trace?

Why don't I have line numbers in my stack trace?

In .NET you need to have the correct debug information (PDB files) alongside your dlls. Currently on iOS, it's not possible to package them, but we're working on a solution to upload them similar to how dSYMs are sent to us. On other platforms, you can bundle the .pdb files to get line numbers. There are also some known issues with getting line numbers when using async. We'll update the FAQ as we make progress on this.

Although not as useful as a proper stack trace with line numbers, you can use the following snippet to collect some line number and file name information yourself by making a simple wrapper for Insights.Report. This uses built-in .NET Callerattributes to tell you where Report was called.

public static void Report (Exception exp, 
ReportSeverity severity= ReportSeverity.Error, [CallerMemberName] string memberName = "", [CallerFilePath] string sourceFilePath = "", [CallerLineNumber] int sourceLineNumber = 0)
{ Insights.Report (exp, new Dictionary<string,object> { {"Method",memberName},
{"File Name",sourceFilePath},
{"Line Number",sourceLineNumber},
}, severity);
}

关于c# - 带有行号的 Xamarin Insights,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34343594/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com