·您现在的位置: 云翼网络 >> 文章中心 >> 网站建设 >> 网站建设开发 >> ASP.NET网站开发 >> 记录调试树(方便跟到具体的调用)

记录调试树(方便跟到具体的调用)

作者:佚名      ASP.NET网站开发编辑:admin      更新时间:2022-07-23
   public static void DebugFunctionTree(string message)         {             try             {                 System.Diagnostics.StackTrace st = new System.Diagnostics.StackTrace();                 System.Diagnostics.StackFrame[] sfs = st.GetFrames();                 StringBuilder sb = new StringBuilder();                 for (int u = 1; u < sfs.Length; ++u)                 {                     System.Reflection.MethodBase mb = sfs[u].GetMethod();                     string pms = string.Empty;                     foreach (var p in mb.GetParameters())                     {                           pms += p.ParameterType.FullName + ":" + p.Name + ",";                     }                     sb.AppendLine(string.Format("[方法调用树][{0}]: {1}.{2} 参数:{3}", u, mb.DeclaringType.FullName, mb.Name, pms));                 }                 XX.General.Exception.Debug(message+"-开始");                 XX.General.Exception.Debug(sb.ToString());                 XX.General.Exception.Debug(message + "-结束");             }             catch (Exception)             {                              }       

        }