为什么 Stack Trace 会显示我的开发文件路径? [英] Why does the Stack Trace shows my development files path?

查看:22
本文介绍了为什么 Stack Trace 会显示我的开发文件路径?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Visual Studio 2010 SP1,编译 WCF 应用程序,将其放在服务器上,当然第一次运行时出错(新功能),将 Stack Trace 输出到日志文件.

Visual Studio 2010 SP1, compiled WCF app, put it on a server, and of course it got an error on the first run (what's new), outputted Stack Trace to log file.

它看到了我的开发环境的路径.为什么?是因为与 Release 相比,我将其部署为 Debug 还是有其他原因,还是无论如何我在输出 Stack Traces 时都应该更加小心?

It's seeing the path to my development environment. Why? Is it because I deployed it as Debug compared to Release or is there something else, or shall I be more careful about outputting Stack Traces regardless?

04/09/2012 03:58:46: Error: Object reference not set to an instance of an object.    at App1.Logging.LogMessageToFile(String msg, Boolean isUsingClickOnceApp) in C:Users
obcubeDocumentsVisual Studio 2010ProjectsAppWebServiceApp1Logging.cs:line 63
   at App1.App1Main.ConnectWebService(String description) in C:Users
obcubeDocumentsVisual Studio 2010ProjectsAppWebServiceApp1International.cs:line 40
04/09/2012 03:58:46: Error: Object reference not set to an instance of an object.    at App1.App1Main.UpdateActivityLog(String data, String userName, Boolean deleteData, Int64 firstId, Int64 lastId, String changeType) in C:Users
obcubeDocumentsVisual Studio 2010ProjectsAppWebServiceApp1App1Main.cs:line 641

谢谢,-抢

推荐答案

这是因为您复制了 .pdb 文件以及可执行文件.CLR 会在生成堆栈跟踪时查找它们,以尝试提供有关跟踪中堆栈帧的尽可能多的信息..pdb 存储源文件名和行号.

It is because you copied the .pdb files as well as the executables. The CLR will look for them when it generates a stack trace to try to give as much info as possible about the stack frames in the trace. The .pdb stores the source file name and line number.

您应该部署代码的发布版本.这样可以进行优化,使您的代码运行得更快.您仍然可以复制该构建的 .pdb 文件,它们通常会删除调试信息.Project + Properties,切换到Release build、Build、Advanced、Debug Info"设置.此处发布版本的正常设置是pdb-only"而不是full".这意味着不包括源文件和行号.这是有道理的,在抖动优化代码后,堆栈跟踪往往有点不可靠.

You are supposed to deploy the Release build of your code. That enables optimizations that can make your code run a lot faster. You can still copy the .pdb files for that build, they normally have that debug info stripped. Project + Properties, switch to the Release build, Build, Advanced, "Debug Info" setting. The normal setting here for release builds is "pdb-only" instead of "full". Which implies that source file and line number is not included. Which makes sense, stack traces tend to be a bit unreliable after the jitter has optimized the code.

这篇关于为什么 Stack Trace 会显示我的开发文件路径?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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