0

enter image description here

I have created a very simple event logger. Is there a way to programmatically add line number, in this case "1587", to the text string that is being written?

This must be done with .NET 3.5 without PDB files.

I am not trying to find the line number during execution, but only the line number as shown in Visual Studio at the time of compilation. The thread shown above, "How do I get the current line number?" is not the answer to my question.

Kit
  • 20,354
  • 4
  • 60
  • 103
Wayne L Waag
  • 25
  • 1
  • 5
  • Hi @Wayne, you can try this solution https://stackoverflow.com/questions/12556767/how-do-i-get-the-current-line-number – Malcolm Salvador Jan 07 '19 at 18:02
  • I've already looked at this thread. I have to use Net 3.5, so the new caller attributes approach won't work. The stackframe doesn't work either since I don't include the pdb files and the code is obfuscated. I'm not trying to find the line number at execution time, but only add the specific line number found during compilation. – Wayne L Waag Jan 07 '19 at 18:30
  • `I am not trying to find the line number during execution, but only the line number as shown in Visual Studio at the time of compilation.` AFAIK these are the same thing. There is no other line number at runtime than the line number shown in visual studio at the time of compilation. – Philip Couling Jan 08 '19 at 13:02

0 Answers0