Why does the Stack Trace shows my development files path?

后端 未结 2 1543
南笙
南笙 2020-12-08 07:25

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.

It\'s

2条回答
  •  余生分开走
    2020-12-08 07:39

    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.

    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.

提交回复
热议问题