By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,719 Members | 1,036 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,719 IT Pros & Developers. It's quick & easy.

StackFrame debug information

P: n/a

I 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
Jul 15 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
ne***************@charter.net wrote:
I 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.
How are you using it? StackFrame is usually used with StackTrace, and it
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

--
http://barrkel.blogspot.com/
Jul 15 '06 #2

P: n/a
Thanks, I missed the true argument.
Jul 15 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.