【发布时间】:2011-06-03 01:44:07
【问题描述】:
我正在使用 asp.net 3.5
在 web.config 中,我使用 debug=false 和 compilerOptions="/debug:pdbonly" 进行优化编译,并且仍然在我的堆栈跟踪中获得行号。这在大多数情况下都有效,但是我的 App_Code 文件夹中的一个函数中有一个错误,并且堆栈跟踪表明错误出现在不可能是错误的行上。
我稍微使用了我的 web.config 设置,发现如果我设置 debug=true 和 compilerOptions=pdbonly,堆栈跟踪显示错误是错误所在行之后的行。如果我删除 compilerOptions=pdbonly,堆栈跟踪会将正确的行报告为错误。
//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;
有没有办法让这项工作正常进行?
【问题讨论】: