问题
I am trying to get the line number from a stack trace in my WP7 app. I have set debug info to full and am running the app in the Debug configuration, but there are no line numbers in stack traces. How can I fix this? I am aware of BugSense, but do not want to use it.
回答1:
Don't think this is even possible, as line  number refers to the number of the line inside code-file, which has lost any relation with the binary after compilation. That's why we use PDB files. They are "databases" for holding the relation between actually executed code and the final binary state of it. 
So don't think there would be any possibility to get a line number at runtime. 
But if you have a PDB file of last compilation, you can potentially get that information from  
StackFrame.GetFileLineNumber , which does:
Gets the line number in the file that contains the code that is executing. This information is typically extracted from the debugging symbols for the executable.
来源:https://stackoverflow.com/questions/12808075/how-to-get-the-line-number-from-a-stack-trace