static CommentDictionaries MkCommentDic(bool result, string name, string msg, StackFrame sf) { var dic = new CommentDictionaries(); if (msg != null) { dic.Add("message", msg); } if (InTodo != null) { dic.Add("severity", "todo"); dic.AddExtension("todo", InTodo); } else { dic.Add("severity", result?"success":"fail"); } MethodBase meth = sf.GetMethod(); var filename = sf.GetFileName(); if (filename != null) { dic.Add("file", MakeRelative(filename)); var line = sf.GetFileLineNumber(); dic.Add("line", line); var col = sf.GetFileColumnNumber(); if (col > 0) { dic.Add("column", col); } } //if(name!=null) dic.Add("name",name); dic.Add("method", string.Format("{0}.{1}", meth.DeclaringType.FullName, meth.Name)); return(dic); }
static void UncaughtHandler(object sender, UnhandledExceptionEventArgs args) { Exception e = (Exception)args.ExceptionObject; if (e is TargetInvocationException && e.InnerException != null) { e = e.InnerException; } using (new WithInvariantCulture()) { lock (WriteLock) { ReportNotOk(null); var dic = new CommentDictionaries(); dic.Add("message", e.Message); dic.Add("severity", "fail"); var meth = e.TargetSite; if (meth != null) { dic.Add("method", string.Format("{0}.{1}", meth.DeclaringType.FullName, meth.Name)); } dic.Add("backtrace", e.InnerException == null?e.StackTrace:e.ToString()); WriteComment(dic, null, null); } } Environment.Exit(1); }
static void WriteComment(CommentDictionaries dic, List <PathEntry> path, string name) { if (dic.Ext != null) { dic.Dic.Add("extensions", dic.Ext); } CommentWriter cw; switch (Format) { case "yaml": cw = new YAMLCommentWriter(Console.Out, BlackBoxTypes); break; case "vs": cw = new VSCommentWriter(Console.Out, BlackBoxTypes); break; default: cw = new TerseCommentWriter(Console.Out, BlackBoxTypes); break; } cw.WriteComment(Cur, dic.Dic, path, name); }