Sometime, i am writing a long code for implement for some logic in my program and inside my code, multiple try-catch block is exist, then i don't know proper error exception for capture message type. So i have capture all information for generated error.
Add below code in your function:
Add below code in your function:
// Get stack trace for the exception with
source file information
var st = new StackTrace(ex, true);
// Get the top stack frame
var frame = st.GetFrame(0);
// Get the line number from the stack frame
var line = frame.GetFileLineNumber();
No comments:
Post a Comment