1

したがって、例外オブジェクトをパラメーターとして受け取るメソッドを順番に呼び出す関数があります。

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、. それを解決する方法は?nullmethodnameline number

4

1 に答える 1