浏览代码

new Exception().StackTrace is better than new StackTrace()...

/main
kg 5 年前
当前提交
62db9151
共有 1 个文件被更改,包括 3 次插入3 次删除
  1. 6
      Runtime/scheduler/ticker.cs

6
Runtime/scheduler/ticker.cs


public class Ticker {
public Ticker(TickerCallback onTick, string debugLabel = null) {
D.assert(() => {
this._debugCreationStack = new StackTrace();
this._debugCreationStack = new Exception().StackTrace;
return true;
});
this._onTick = onTick;

public readonly string debugLabel;
StackTrace _debugCreationStack;
string _debugCreationStack;
public override string ToString() {
return this.toString(debugIncludeStack: false);

if (debugIncludeStack) {
buffer.AppendLine();
buffer.AppendLine("The stack trace when the " + this.GetType() + " was actually created was:");
UIWidgetsError.defaultStackFilter(this._debugCreationStack.ToString().TrimEnd().Split('\n'))
UIWidgetsError.defaultStackFilter(this._debugCreationStack.TrimEnd().Split('\n'))
.Each(line => buffer.AppendLine(line));
}

正在加载...
取消
保存