private void OnResult(object sender, IResult result) { if (result != null) { if (!string.IsNullOrEmpty(result.Message)) { _output.OutputTaskItemString(result.Message, EnvDTE.vsTaskPriority.vsTaskPriorityHigh, "Test Failure", EnvDTE.vsTaskIcon.vsTaskIconShortcut, "", 0, result.Description, true); if (!result.Message.EndsWith("\n")) { _output.OutputString("\n"); } } if (result.Skipped) { _skipCount += result.TestCount; } else if (result.Failed) { _failCount += result.TestCount; } else if (result.Passed) { _passCount += result.TestCount; } } }
private void OutputTaskItem(String message, EnvDTE.vsTaskPriority priority, String subcategory, String file, int line, String description) { OutputPane.Activate(); OutputPane.OutputTaskItemString( message, priority, EnvDTE.vsTaskCategories.vsTaskCategoryBuildCompile, EnvDTE.vsTaskIcon.vsTaskIconCompile, file, line, description, true); }
protected void WriteLine(string message) { if (message == null) { return; } Log.Info(message); EnvDTE.OutputWindowPane pane = GetOutputPane(); if (pane == null) { return; } using (StringReader sr = new StringReader(message)) { string line; while (null != (line = sr.ReadLine())) { bool writeRaw = true; try { Match match = RegexPatterns.VSErrorMessage.Match(message); if (match.Success && File.Exists(match.Groups["path"].Value)) { int lineNo; int.TryParse(match.Groups["line"].Value, out lineNo); pane.OutputTaskItemString(line + Environment.NewLine, EnvDTE.vsTaskPriority.vsTaskPriorityMedium, pane.Name, EnvDTE.vsTaskIcon.vsTaskIconCompile, match.Groups["path"].Value, lineNo, match.Groups["message"].Value, true); writeRaw = false; } } catch { writeRaw = true; } if (writeRaw) { pane.OutputString(line + Environment.NewLine); } } } }
private void OutputTaskItem(string message, EnvDTE.vsTaskPriority priority, string subcategory, string file, int line, string description) { ThreadHelper.JoinableTaskFactory.Run(async() => { await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(); OutputPane.Activate(); OutputPane.OutputTaskItemString( message, priority, EnvDTE.vsTaskCategories.vsTaskCategoryBuildCompile, EnvDTE.vsTaskIcon.vsTaskIconCompile, file, line, description, true); }); }