|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
StackFrame debug informationI have compiled in DEBUG mode but don't get the debug information from
StackFrame class. Is there a specific setting I need to use so that information is included for a debug build. Thanks Tom newscorrespond***@charter.net wrote:
> I have compiled in DEBUG mode but don't get the debug information from How are you using it? StackFrame is usually used with StackTrace, and it> StackFrame class. Is there a specific setting I need to use so that > information is included for a debug build. isn't sensitive to DEBUG (although some inlining may occur at runtime when compiled in Release mode). To get file information, you must always create a PDB and distribute it - but it isn't necessary to use full debugging. Perhaps you aren't using the StackTrace constructor which takes the boolean argument to collect file information? Example: ---8<--- using System; using System.Diagnostics; class App { static void Main() { StackFrame frame = new StackTrace(true).GetFrame(0); Console.WriteLine("{0} ({1})", frame.GetFileName(), frame.GetFileLineNumber()); } } --->8--- Compiled with: ---8<--- csc -debug:pdbonly -optimize+ Test.cs --->8--- When run, it produces this output on my machine: ---8<--- c:\proj\Test\Test.cs (8) --->8--- -- Barry |
|||||||||||||||||||||||