Need help finding line of source code from stack trace byte offset

can someone tell me how to find the line of source code using byte offset (from stack trace) in wp7?

+2
windows-phone-7
source share
1 answer

This is what I used, but it did not cause much interest in the phone - but it might work for you with tweeking:

private static string lineAndMethod() { int stack_frame_depth = 5; StackFrame sf = new StackFrame(stack_frame_depth, true); while (sf.GetFileName() == null && stack_frame_depth > 0) sf = new StackFrame(--stack_frame_depth, true); if (sf.GetFileName() == null) // Failed. return ""; MethodBase mb_caller = sf.GetMethod(); retrun string.Format("{0}, {1}: {2}]", Path.GetFileName(sf.GetFileName()), mb_caller.Name, sf.GetFileLineNumber()); } 
0
source share

All Articles