📄 debughelper.cs
字号:
namespace Imps.Utils
{
using System;
using System.Diagnostics;
using System.Text;
public static class DebugHelper
{
public static void BuildCallStackString(StringBuilder sb, int skipFrames)
{
StackTrace trace = new StackTrace(skipFrames + 1, true);
for (int i = 0; i < trace.FrameCount; i++)
{
StackFrame frame = trace.GetFrame(i);
if (i != 0)
{
sb.Append(" ");
}
sb.Append(frame.GetMethod());
string fileName = frame.GetFileName();
if (!string.IsNullOrEmpty(fileName))
{
sb.Append("; ");
sb.Append(fileName);
sb.Append(": ");
sb.Append(frame.GetFileLineNumber());
}
sb.AppendLine();
}
}
public static string GetCallStackString(int skipFrames)
{
StringBuilder sb = new StringBuilder();
BuildCallStackString(sb, skipFrames + 1);
return sb.ToString();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -