需要帮助寻找从堆栈跟踪字节偏移电压源$ C ​​$ C线 [英] Need Help to find source code line from stack trace byte offset

查看:118
本文介绍了需要帮助寻找从堆栈跟踪字节偏移电压源$ C ​​$ C线的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

任何一个可以告诉我如何找到使用字节的源$ 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());
}

这篇关于需要帮助寻找从堆栈跟踪字节偏移电压源$ C ​​$ C线的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆