如何在没有pdb的堆栈跟踪中包含行号? [英] How can I include line numbers in a stack trace without a pdb?

查看:451
本文介绍了如何在没有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的堆栈跟踪中包含行号?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆