由网友(所谓伊人,在水一方)分享简介:任何一个可以告诉我如何找到使用字节的源$ C $ C线(从堆栈跟踪)在WP7偏移?can any one tell me how to find the source code line using byte offset (from stack trace) in wp7?推荐答案这是一些香港专业教育学院使...
任何一个可以告诉我如何找到使用字节的源$ C $ C线(从堆栈跟踪)在WP7偏移?
can any one tell me how to find the source code line using byte offset (from stack trace) in wp7?
推荐答案
这是一些香港专业教育学院使用,但它不是赢手机的具体 - 但它可能为你工作的一些tweeking:
This is something Ive used but its not win phone specific - but it might work for you with some 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());
}
相关推荐
最新文章