堆栈跟踪行号是错的调试=假,compilerOptions = QUOT; /调试:pdbonly" [英] stack trace line numbers are wrong with debug=false and compilerOptions="/debug:pdbonly"
问题描述
我使用asp.net 3.5
I'm using asp.net 3.5
在web.config中,我有调试=假,compilerOptions =/调试:pdbonly与优化和编译仍然得到行号在我的堆栈跟踪。这适用于大部分,但我曾在一个函数中的错误在我的App_Code文件夹和堆栈跟踪说的是一个行不可能是一个错误的错误。
In web.config, I have debug=false and compilerOptions="/debug:pdbonly" to compile with optimizations and still get line numbers in my stack traces. This works for the most part, but I had a bug in a function in my App_Code folder and the stack trace said the error was on a line that couldn't possibly be an error.
我打我的web.config设置一点点发现,如果我设置调试=真实compilerOptions = pdbonly,堆栈跟踪说,错误是直接行后错误行。如果我删除compilerOptions = pdbonly,堆栈跟踪报道的正确路线的错误。
I played with my web.config settings a little bit and found that if I set debug=true and compilerOptions=pdbonly, the stack trace says the error is the line directly after the line with the bug. If I remove the compilerOptions=pdbonly, the stack trace reports the correct line as the error.
//the actual bug (only reported when debug=true and no compiler options set)
var dt = new DateTime(-1,-1,-1);
//
//...lots of non-buggy code between
//
//the bug according to the stack trace when
// debug=false and compilerOptions="/debug:pdbonly"
var ts = TimeSpan.Empty;
有没有一种方法,使这项工作吧?
Is there a way to make this work right?
推荐答案
编译器优化可以影响行号报告的堆栈跟踪。您可以设置编译器选项 /优化改进 - 禁用它们,那么你的堆栈跟踪行号应该是正确的。
Compiler optimizations can affect the line numbering reported in the stack trace. You can set the compiler option /optimze- to disable them, then your stack trace line numbers should be correct.
例如:<编译compilerOptions =/ optimze- /调试:pdbonly/>
这篇关于堆栈跟踪行号是错的调试=假,compilerOptions = QUOT; /调试:pdbonly"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!