The #line
processor directive in C# increases the line number for each line to the end of file or until it reaches another #line
processor directive; an auto incremental line number.
That was interesting! For example:
try
{
#line 110
act();
throw new InvalidOperationException();
}
catch (Exception x) { Console.WriteLine(x); }
Shows that an exception happened at line 111 (Not 110!).
Question: Assume that #line shows a line number different from real line number. For example #line 110
is actually placed at real line number 13. Now is there a way to cancel the functionality of #line
and show that an exception happened on actual line 23 (not 120)?
Note: I just want to be sure I am not missing anything (or doing anything stupid).
I am working with Visual Studio 2012 on a .NET 4.5 project.
You're looking for #line default
, which reverts back to the natural line numbering.
See the documentation