C#我的应用程序中崩溃报告的最佳实践

时间:2009-12-16 07:12:21

标签: c# frameworks crash-reports

我需要在我的C#(WPF)应用程序上实现崩溃报告框架,所以我需要完整的调用堆栈,你们建议做什么。

1 个答案:

答案 0 :(得分:3)

StackTrace

        StackTrace st = new StackTrace(true);
        for(int i =0; i< st.FrameCount; i++ )
        {
            // Note that high up the call stack, there is only
            // one stack frame.
            StackFrame sf = st.GetFrame(i);
            Console.WriteLine();
            Console.WriteLine("High up the call stack, Method: {0}",
                sf.GetMethod());

            Console.WriteLine("High up the call stack, Line Number: {0}",
                sf.GetFileLineNumber());
        }