したがって、例外オブジェクトをパラメーターとして受け取るメソッドを順番に呼び出す関数があります。
public DataSet SomeFunction()
{
try
{
}
catch (Exception ex)
{
ErrorLogInDB.LogError(ex);
throw;
}
}
public static void LogError(Exception exception)
{
StackTrace st = new StackTrace(exception, true);
StackFrame frame = new StackFrame(0);
MethodBase site = exception.TargetSite;
string fileName = frame.GetFileName();
string methodName = site.Name;
int lineNo = frame.GetFileLineNumber();
string errorDescription = exception.Message;
}
上記の関数から、は正しくLogError
なくfilename
、. それを解決する方法は?null
methodname
line number