Melhores práticas para relatórios de falhas em C# meu aplicativo
-
19-09-2019 - |
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.
Solução
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