public string toString(bool debugIncludeStack = false) { var buffer = new StringBuilder(); buffer.Append(this.GetType() + "("); D.assert(() => { if (this.debugLabel != null) { buffer.Append(this.debugLabel()); } return(true); }); buffer.Append(')'); D.assert(() => { if (debugIncludeStack) { buffer.AppendLine(); buffer.AppendLine("The stack trace when the " + this.GetType() + " was actually created was:"); UIWidgetsError.defaultStackFilter(this._debugCreationStack.TrimEnd().Split('\n')) .Each(line => buffer.AppendLine(line)); } return(true); }); return(buffer.ToString()); }
void _invokeFrameCallback(FrameCallback callback, TimeSpan timeStamp, StackTrace callbackStack = null) { D.assert(callback != null); D.assert(_FrameCallbackEntry.debugCurrentCallbackStack == null); D.assert(() => { _FrameCallbackEntry.debugCurrentCallbackStack = callbackStack; return(true); }); try { callback(timeStamp); } catch (Exception ex) { UIWidgetsError.reportError(new UIWidgetsErrorDetails( exception: ex, library: "scheduler library", context: "during a scheduler callback", informationCollector: callbackStack == null ? (InformationCollector)null : information => { information.AppendLine( "\nThis exception was thrown in the context of a scheduler callback. " + "When the scheduler callback was _registered_ (as opposed to when the " + "exception was thrown), this was the stack:" ); UIWidgetsError.defaultStackFilter(callbackStack.ToString().TrimEnd().Split('\n')) .Each((line) => information.AppendLine(line)); } )); } D.assert(() => { _FrameCallbackEntry.debugCurrentCallbackStack = null; return(true); }); }
void _invokeFrameCallback(FrameCallback callback, TimeSpan timeStamp, string callbackStack = null) { D.assert(callback != null); D.assert(_FrameCallbackEntry.debugCurrentCallbackStack == null); D.assert(() => { _FrameCallbackEntry.debugCurrentCallbackStack = callbackStack; return(true); }); try { callback(timeStamp: timeStamp); } catch (Exception ex) { IEnumerable <DiagnosticsNode> infoCollector() { yield return(DiagnosticsNode.message( "\nThis exception was thrown in the context of a scheduler callback. " + "When the scheduler callback was _registered_ (as opposed to when the " + "exception was thrown), this was the stack:")); var builder = new StringBuilder(); foreach (var line in UIWidgetsError.defaultStackFilter( callbackStack.TrimEnd().Split('\n'))) { builder.AppendLine(value: line); } yield return(DiagnosticsNode.message(builder.ToString())); } UIWidgetsError.reportError(new UIWidgetsErrorDetails( exception: ex, "scheduler library", new ErrorDescription("during a scheduler callback"), informationCollector: callbackStack == null ? (InformationCollector)null : infoCollector )); } D.assert(() => { _FrameCallbackEntry.debugCurrentCallbackStack = null; return(true); }); }