Pergunta

Preciso implementar a estrutura de relatórios de falhas no meu aplicativo C#(WPF), por isso preciso de pilha de chamadas completas, o que vocês sugeririam para fazer isso.

Foi útil?

Solução

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());
        }
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top