2

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

4

1 回答 1

3

堆栈跟踪

        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());
        }
于 2009-12-16T07:14:12.267 回答