Question

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?

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top