- Home /
No line numbers in stack trace
I've been using Unity for a while, and usually when an Exception is thrown and I click it in the console, it gives me line numbers for every part of the stack trace. Here is what is looks like now (part of it):
ArgumentOutOfRangeException: Argument is out of range.
Parameter name: index
System.Collections.Generic.List`1[System.Collections.Generic.List`1[System.Boolean]].get_Item (Int32 index) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Collections.Generic/List.cs:633)
GameModeScreen.UpdateVariation ()
GameModeScreen.set_currVariation (Int32 value)
GameModeScreen.set_currMode (Int32 value)
GameModeScreen.HigherMode ()
At the end of the third line it gives me a line in some c# library (".../List.cs:633"), it used to also print those line numbers for the scripts written by me. For example the last lines, it would usually print the corresponding line in the "GameModeScreen" script. Did I acidentally disable that?
Answer by FortisVenaliter · Sep 07, 2017 at 06:47 PM
So, typically this happens for one of two reasons:
You built in release mode, so debug symbols weren't generated. This is why built game logs don't include line numbers. Unless you're importing DLLs though, this is pretty unusual in the editor. So, it's most likely...
The compiler optimized your code in such a way that the line numbers are no longer correct, and it therefore leaves them off. This can happen for a number of reasons; using coroutines, certain loop types, and (most likely for you) putting major logic into a property getter/accessor.
So, in theory, instead of currMode { get; set; }, if you use SetCurrMode() and GetCurrMode(), you should get your line numbers back.
Your answer
Follow this Question
Related Questions
DebugConsole console clicking 5 Answers
How to clear a specific error/warning in the console output window? 0 Answers
Double click on Console Window 1 Answer
Can I throw an Exception that refers to a gameobject like Debug.Log does? 1 Answer
Editor Console window message no longer wraps... Help? Please? 1 Answer