C# 预编译会影响行号吗?
我正在尝试从报告的堆栈跟踪中调试产品中的问题,但行号没有对齐?预编译是否会影响行号,“else”中的代码(实际上)是否计入行号?
例如:
1 #if DEBUG
2 DoItemA();
3 #else
4 DoItemB()
5 #endif
2 行代码(编译时)、5 行代码或 1 行代码(在预编译时计算出的唯一相关行)也是如此。
当运行时,我的堆栈跟踪显示错误发生第3行,它是如何计算行数的?
I'm trying to debug a problem in prod from a reported stack trace, but the line numbers aren't lining up? Do precompiles affect line numbers, and does the code in the "else" (as it were) count toward line numbers?
For example:
1 #if DEBUG
2 DoItemA();
3 #else
4 DoItemB()
5 #endif
So is that 2 lines of code (when compiled), 5 lines of code, or 1 line of code (the only line calculated to pertinent at pre-compile)
When that runs, and my stack trace says the error was on line 3, how did it count line numbers?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
C# 中没有单独的预编译器。因此,堆栈跟踪中的行号应与原始文件中的行号相同。
There is no separate precompiler in C#. So the line numbers in the stack-trace should be identical to the line numbers in the original file.