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

StackFrame GetFileName and GetFileLineNumber empty - sometimes

P: n/a
I've seen some other posts referring to this problem, but didn't find
any solutions.

We're trying to log a call stack when we have a problem, using the
StackTrace and StackFrame classes in C#. They are created via new
StackTrace(true) to get the debugging info and trace.GetFrame(i). Our
classes are all compiled Debug. What we find is, even though the IDE
debugger knows the line numbers of all the methods, when we walk the
stack trace in our code, some of our methods' frames have GetFileName()
returning null and GetFileLineNumber() returning zero. Yet for other
frames it knows both values.

What would prevent these fields from being filled in for an assembly
built Debug?

How does the debugger know the line number when StackTrace doesn't?

Nov 16 '05 #1
Share this Question
Share on Google+
1 Reply

P: n/a
The frames which don't have the line number filled in belong to a type
which has some properties and methods marked [CLSCompliant(false)],
although none of those are actually on the stack at this time. Would
the presence of that attribute anywhere in the type prevent
StackTrace/StackFrame from getting line number information for any
method in that type?

Nov 16 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.