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

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

问题描述

Visual Studio 2010 SP1,已编译的WCF应用程序,将其放在服务器上,当然,在第一次运行时(新功能)出现错误,将堆栈跟踪输出到日志文件。

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还是有其他东西,还是我应该更小心地输出堆栈跟踪信息?

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\robcube\Documents\Visual Studio 2010\Projects\AppWebService\App1\Logging.cs:line 63
   at App1.App1Main.ConnectWebService(String description) in C:\Users\robcube\Documents\Visual Studio 2010\Projects\AppWebService\App1\International.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\robcube\Documents\Visual Studio 2010\Projects\AppWebService\App1\App1Main.cs:line 641

谢谢,
-rob

Thanks, -rob

推荐答案

这是因为您复制了.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.

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

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.

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

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