本文介绍了如何在没有 pdb 的情况下在堆栈跟踪中包含行号?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

我们目前正在分发一个没有 .pdb 文件的 WinForms 应用程序,以节省客户端计算机上的空间和下载带宽.当我们获得堆栈跟踪时,我们获得的是方法名称而不是行号.有没有办法在不分发 .pdb 文件的情况下获取行号?

We are currently distributing a WinForms app without .pdb files to conserve space on client machines and download bandwidth. When we get stack traces, we are getting method names but not line numbers. Is there any way to get the line numbers without resorting to distributing the .pdb files?

推荐答案

除非捆绑 PDB,否则您无法直接从应用程序获得带有行号的堆栈跟踪.但是,如果您拥有与交付给客户的应用程序版本相同的 PDB 文件,并且您不介意编写一些简单的脚本,那么您可以转向.NET 堆栈跟踪和 IL 偏移回到行号.

You can't get a stack trace with line numbers directly from your application unless you bundle the PDB. However, if you have the PDB files for the same version of the app that you ship to your customers, and you don't mind some light scripting, then you can turn the .NET stack trace and IL offsets back into line numbers.

在构建过程中,使用 Mike Stall 的 pdb2xml 转换器,作为他出色的 MDbg 托管代码调试器,并将它们存储在安全的地方(例如,源代码控制).当您从客户端获得堆栈跟踪时,您可以从 XML 数据中查询 IL 偏移量以确定相关的行号.如果您的堆栈跟踪被提交到网站,您甚至可以自动进行转换,这样开发人员就可以在案例进入收件箱时获得完整详细的堆栈跟踪.

During your build process, use Mike Stall's pdb2xml converter, distributed as part of his excellent MDbg managed code debugger, and store them some place secure (e.g., source control). When you get a stack trace back from the client, you can query the IL offset from the XML data to determine the relevant line number. If your stack traces get submitted to a website, you can even automate the conversion, so that developers will already be getting fully detailed stack traces by the time the cases hit their inbox.

这篇关于如何在没有 pdb 的情况下在堆栈跟踪中包含行号?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-06 12:06