C# 预编译会影响行号吗?

发布于 2024-12-02 22:45:25 字数 272 浏览 6 评论 0原文

我正在尝试从报告的堆栈跟踪中调试产品中的问题,但行号没有对齐?预编译是否会影响行号,“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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

我们只是彼此的过ke 2024-12-09 22:45:25

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文