/// <summary> /// returns a stack frame item from a stack frame. This /// </summary> /// <param name="frame"></param> /// <returns></returns> public StackFrameItem(StackFrame frame) { // set default values m_lineNumber = NA; m_fileName = NA; m_method = new MethodItem(); m_className = NA; try { // get frame values m_lineNumber = frame.GetFileLineNumber().ToString(System.Globalization.NumberFormatInfo.InvariantInfo); m_fileName = frame.GetFileName(); // get method values MethodBase method = frame.GetMethod(); if (method != null) { if(method.DeclaringType != null) m_className = method.DeclaringType.FullName; m_method = new MethodItem(method); } } catch (Exception ex) { LogLog.Error(declaringType, "An exception ocurred while retreiving stack frame information.", ex); } // set full info m_fullInfo = m_className + '.' + m_method.Name + '(' + m_fileName + ':' + m_lineNumber + ')'; }
internal override string GetMethodInformation(MethodItem method) { string returnValue=""; try { string param = ""; string[] names = method.Parameters; StringBuilder sb = new StringBuilder(); if (names != null && names.GetUpperBound(0) > 0) { for (int i = 0; i <= names.GetUpperBound(0); i++) { sb.AppendFormat("{0}, ", names[i]); } } if (sb.Length > 0) { sb.Remove(sb.Length - 2, 2); param = sb.ToString(); } returnValue=base.GetMethodInformation(method) + "(" + param + ")"; } catch (Exception ex) { LogLog.Error(declaringType, "An exception ocurred while retreiving method information.", ex); } return returnValue; }