KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
Okay; assuming this code running in debug mode - static StackFrame GetTopFrameWithLineNumber(Exception e) { StackTrace trace = new StackTrace(e); foreach (StackFrame frame in trace.GetFrames()) { if (frame.GetFileLineNumber() != 0) { return frame; } } return null; } I'm ALWAYS returning null. Why do the stack frames have no line numbers when if I inspect the Exception.StackTrace string, it clearly does have them for any non-framework code? Is there some issue with constructing a stack trace from an exception that i'm not aware of? EDIT FOR CLARITY: In the thrown exception I can see the line numbers in the StackTrace property. I'm assuming that means I have everything else I need.
Tags (comma-separated)
Save Edits
Cancel