不要在堆栈跟踪中显示构建计算机的文件路径 [英] Do not show file paths of build machine in stack trace

查看:79
本文介绍了不要在堆栈跟踪中显示构建计算机的文件路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在开发具有自己的日志记录的C#应用​​程序。引发异常时,异常将保存到列表中,用户可以通过列表视图进行查看。
当用户在列表视图中单击一个例外时,该例外的堆栈跟踪将显示在一个文本框中。但是,即使在远程计算机上执行程序时,堆栈跟踪也会显示从编译应用程序的计算机到原始源文件的文件路径。

I am currently developing a C# application which has got it's own logging. When exceptions are thrown, the exception is saved into a list which can be viewed by the user via a list view. When the user clicks on a exception in the list view, the stack trace of the exception is shown in a text box. But even when I am executing the program on a remote machine, the stack trace shows the file paths to the original source files from the machine where the application was compiled.

例如:

at C:\Folder1\Folder2\Class1.cs:81
at C:\Folder1\Folder2\Class2.cs:65
at C:\Folder1\Folder1\Class3.cs:21

仅显示不带文件夹的源文件会很好...

Only displaying the source files without folders would be nice...

如何更改此行为?

是否有任何本机解决方案?还是只需要简单地进行一些字符串操作?

Is there any native solution? Or do I have to simply do some string manipulation?

推荐答案

您可能已经在安装的应用程序中包含.pdb文件。没有.pdb文件,它不应显示文件位置。

You probably have the .pdb files with the installed app. Without the .pdb files, it should not show the file locations.

请查看在Windows服务中的异常堆栈跟踪中获取行号

在没有pdb的堆栈跟踪中包括行号吗?


除非您捆绑了PDB,否则无法直接从应用程序
中获得具有行
数字的堆栈跟踪。

You can't get a stack trace with line numbers directly from your application unless you bundle the PDB.

这篇关于不要在堆栈跟踪中显示构建计算机的文件路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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