【问题标题】:Best practice for crash reporting in C# my application在 C# 我的应用程序中报告崩溃的最佳实践
【发布时间】:2009-12-16 07:12:21
【问题描述】:

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

【问题讨论】:

    标签: c# frameworks crash-reports


    【解决方案1】:

    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());
            }
    

    【讨论】:

    • 最好登录文件而不是控制台。
    • 我只是展示如何获取堆栈跟踪 Ankur,它不是真正的应用
    猜你喜欢
    • 2010-09-26
    • 2011-07-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-07-02
    • 2010-09-19
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多