public void LogWarningEvent(BuildWarningEventArgs e) { LogWarningEvents.Add(e); }
void eventSource_WarningRaised(object sender, BuildWarningEventArgs e) { }
/// <summary> /// Logs an error event for the current task /// Thread safe. /// </summary> /// <param name="e">The event args</param> public void LogErrorEvent(net.r_eg.IeXod.Framework.BuildErrorEventArgs e) { lock (_callbackMonitor) { ErrorUtilities.VerifyThrowArgumentNull(e, "e"); if (!_activeProxy) { // The task has been logging on another thread, typically // because of logging a spawned process's output, and has // not terminated this logging before it returned. This is common // enough that we don't want to crash and break the entire build. But // we don't have any good way to log it any more, as not only has this task // finished, the whole build might have finished! The task author will // just have to figure out that their task has a bug by themselves. if (s_breakOnLogAfterTaskReturns) { Trace.Fail(String.Format(CultureInfo.CurrentUICulture, "Task at {0}, after already returning, attempted to log '{1}'", _taskLocation.ToString(), e.Message)); } return; } // If we are in building across process we need the events to be serializable. This method will // check to see if we are building with multiple process and if the event is serializable. It will // also log a warning if the event is not serializable and drop the logging message. if (IsRunningMultipleNodes && !IsEventSerializable(e)) { return; } if (_convertErrorsToWarnings) { // Convert the error into a warning. We do this because the whole point of // ContinueOnError is that a project author expects that the task might fail, // but wants to ignore the failures. This implies that we shouldn't be logging // errors either, because you should never have a successful build with errors. BuildWarningEventArgs warningEvent = new BuildWarningEventArgs ( e.Subcategory, e.Code, e.File, e.LineNumber, e.ColumnNumber, e.EndLineNumber, e.EndColumnNumber, e.Message, e.HelpKeyword, e.SenderName ); warningEvent.BuildEventContext = _taskLoggingContext.BuildEventContext; _taskLoggingContext.LoggingService.LogBuildEvent(warningEvent); // Log a message explaining why we converted the previous error into a warning. _taskLoggingContext.LoggingService.LogComment(_taskLoggingContext.BuildEventContext, MessageImportance.Normal, "ErrorConvertedIntoWarning"); } else { e.BuildEventContext = _taskLoggingContext.BuildEventContext; _taskLoggingContext.LoggingService.LogBuildEvent(e); _taskLoggingContext.HasLoggedErrors = true; } } }
/// <summary> /// Prints a warning event /// </summary> public void WarningHandler(object sender, BuildWarningEventArgs e) { InitializeBaseConsoleLogger(); // for compat: see DDB#136924 consoleLogger.WarningHandler(sender, e); }
/// <summary> /// Handle a warning event /// </summary> /// <param name="sender">Who sent the event</param> /// <param name="e">Event raised on the event source</param> private void Source_WarningRaised(object sender, BuildWarningEventArgs e) { HandleEvent(e); }
public void LogWarningEvent(BuildWarningEventArgs e) { LogWarningEvents.Add(e); Console.WriteLine(e.Message); }
public void LogWarningEvent(BuildWarningEventArgs e) => _warnings.AppendLine(e.Message);
private void BuildWarning(object sender, BuildWarningEventArgs e) { string message = FormatWarningMessage(e); SendMessage(5, message); }
/// <summary> /// Sends the provided warning back to the parent node to be logged, tagging it with /// the parent node's ID so that, as far as anyone is concerned, it might as well have /// just come from the parent node to begin with. /// </summary> public void LogWarningEvent(BuildWarningEventArgs e) { SendBuildEvent(e); }
/// <summary> /// Compares two LogMessagePacket objects for equivalence. /// </summary> private void CompareLogMessagePackets(LogMessagePacket left, LogMessagePacket right) { Assert.Equal(left.EventType, right.EventType); Assert.Equal(left.NodeBuildEvent.Value.Value.GetType(), right.NodeBuildEvent.Value.Value.GetType()); CompareNodeBuildEventArgs(left.NodeBuildEvent.Value, right.NodeBuildEvent.Value, left.EventType == LoggingEventType.CustomEvent /* expectInvalidBuildEventContext */); switch (left.EventType) { case LoggingEventType.BuildErrorEvent: BuildErrorEventArgs leftError = left.NodeBuildEvent.Value.Value as BuildErrorEventArgs; BuildErrorEventArgs rightError = right.NodeBuildEvent.Value.Value as BuildErrorEventArgs; Assert.NotNull(leftError); Assert.NotNull(rightError); Assert.Equal(leftError.Code, rightError.Code); Assert.Equal(leftError.ColumnNumber, rightError.ColumnNumber); Assert.Equal(leftError.EndColumnNumber, rightError.EndColumnNumber); Assert.Equal(leftError.EndLineNumber, rightError.EndLineNumber); Assert.Equal(leftError.File, rightError.File); Assert.Equal(leftError.LineNumber, rightError.LineNumber); Assert.Equal(leftError.Message, rightError.Message); Assert.Equal(leftError.Subcategory, rightError.Subcategory); break; case LoggingEventType.BuildFinishedEvent: BuildFinishedEventArgs leftFinished = left.NodeBuildEvent.Value.Value as BuildFinishedEventArgs; BuildFinishedEventArgs rightFinished = right.NodeBuildEvent.Value.Value as BuildFinishedEventArgs; Assert.NotNull(leftFinished); Assert.NotNull(rightFinished); Assert.Equal(leftFinished.Succeeded, rightFinished.Succeeded); break; case LoggingEventType.BuildMessageEvent: BuildMessageEventArgs leftMessage = left.NodeBuildEvent.Value.Value as BuildMessageEventArgs; BuildMessageEventArgs rightMessage = right.NodeBuildEvent.Value.Value as BuildMessageEventArgs; Assert.NotNull(leftMessage); Assert.NotNull(rightMessage); Assert.Equal(leftMessage.Importance, rightMessage.Importance); break; case LoggingEventType.BuildStartedEvent: BuildStartedEventArgs leftBuildStart = left.NodeBuildEvent.Value.Value as BuildStartedEventArgs; BuildStartedEventArgs rightBuildStart = right.NodeBuildEvent.Value.Value as BuildStartedEventArgs; Assert.NotNull(leftBuildStart); Assert.NotNull(rightBuildStart); break; case LoggingEventType.BuildWarningEvent: BuildWarningEventArgs leftBuildWarn = left.NodeBuildEvent.Value.Value as BuildWarningEventArgs; BuildWarningEventArgs rightBuildWarn = right.NodeBuildEvent.Value.Value as BuildWarningEventArgs; Assert.NotNull(leftBuildWarn); Assert.NotNull(rightBuildWarn); Assert.Equal(leftBuildWarn.Code, rightBuildWarn.Code); Assert.Equal(leftBuildWarn.ColumnNumber, rightBuildWarn.ColumnNumber); Assert.Equal(leftBuildWarn.EndColumnNumber, rightBuildWarn.EndColumnNumber); Assert.Equal(leftBuildWarn.EndLineNumber, rightBuildWarn.EndLineNumber); Assert.Equal(leftBuildWarn.File, rightBuildWarn.File); Assert.Equal(leftBuildWarn.LineNumber, rightBuildWarn.LineNumber); Assert.Equal(leftBuildWarn.Subcategory, rightBuildWarn.Subcategory); break; case LoggingEventType.CustomEvent: ExternalProjectStartedEventArgs leftCustom = left.NodeBuildEvent.Value.Value as ExternalProjectStartedEventArgs; ExternalProjectStartedEventArgs rightCustom = right.NodeBuildEvent.Value.Value as ExternalProjectStartedEventArgs; Assert.NotNull(leftCustom); Assert.NotNull(rightCustom); Assert.Equal(leftCustom.ProjectFile, rightCustom.ProjectFile); Assert.Equal(leftCustom.TargetNames, rightCustom.TargetNames); break; case LoggingEventType.ProjectFinishedEvent: ProjectFinishedEventArgs leftProjectFinished = left.NodeBuildEvent.Value.Value as ProjectFinishedEventArgs; ProjectFinishedEventArgs rightProjectFinished = right.NodeBuildEvent.Value.Value as ProjectFinishedEventArgs; Assert.NotNull(leftProjectFinished); Assert.NotNull(rightProjectFinished); Assert.Equal(leftProjectFinished.ProjectFile, rightProjectFinished.ProjectFile); Assert.Equal(leftProjectFinished.Succeeded, rightProjectFinished.Succeeded); break; case LoggingEventType.ProjectStartedEvent: ProjectStartedEventArgs leftProjectStarted = left.NodeBuildEvent.Value.Value as ProjectStartedEventArgs; ProjectStartedEventArgs rightProjectStarted = right.NodeBuildEvent.Value.Value as ProjectStartedEventArgs; Assert.NotNull(leftProjectStarted); Assert.NotNull(rightProjectStarted); Assert.Equal(leftProjectStarted.ParentProjectBuildEventContext, rightProjectStarted.ParentProjectBuildEventContext); Assert.Equal(leftProjectStarted.ProjectFile, rightProjectStarted.ProjectFile); Assert.Equal(leftProjectStarted.ProjectId, rightProjectStarted.ProjectId); Assert.Equal(leftProjectStarted.TargetNames, rightProjectStarted.TargetNames); // UNDONE: (Serialization.) We don't actually serialize the items at this time. // Assert.AreEqual(leftProjectStarted.Items, rightProjectStarted.Items); // UNDONE: (Serialization.) We don't actually serialize properties at this time. // Assert.AreEqual(leftProjectStarted.Properties, rightProjectStarted.Properties); break; case LoggingEventType.TargetFinishedEvent: TargetFinishedEventArgs leftTargetFinished = left.NodeBuildEvent.Value.Value as TargetFinishedEventArgs; TargetFinishedEventArgs rightTargetFinished = right.NodeBuildEvent.Value.Value as TargetFinishedEventArgs; Assert.NotNull(leftTargetFinished); Assert.NotNull(rightTargetFinished); Assert.Equal(leftTargetFinished.ProjectFile, rightTargetFinished.ProjectFile); Assert.Equal(leftTargetFinished.Succeeded, rightTargetFinished.Succeeded); Assert.Equal(leftTargetFinished.TargetFile, rightTargetFinished.TargetFile); Assert.Equal(leftTargetFinished.TargetName, rightTargetFinished.TargetName); break; case LoggingEventType.TargetStartedEvent: TargetStartedEventArgs leftTargetStarted = left.NodeBuildEvent.Value.Value as TargetStartedEventArgs; TargetStartedEventArgs rightTargetStarted = right.NodeBuildEvent.Value.Value as TargetStartedEventArgs; Assert.NotNull(leftTargetStarted); Assert.NotNull(rightTargetStarted); Assert.Equal(leftTargetStarted.ProjectFile, rightTargetStarted.ProjectFile); Assert.Equal(leftTargetStarted.TargetFile, rightTargetStarted.TargetFile); Assert.Equal(leftTargetStarted.TargetName, rightTargetStarted.TargetName); break; case LoggingEventType.TaskCommandLineEvent: TaskCommandLineEventArgs leftCommand = left.NodeBuildEvent.Value.Value as TaskCommandLineEventArgs; TaskCommandLineEventArgs rightCommand = right.NodeBuildEvent.Value.Value as TaskCommandLineEventArgs; Assert.NotNull(leftCommand); Assert.NotNull(rightCommand); Assert.Equal(leftCommand.CommandLine, rightCommand.CommandLine); Assert.Equal(leftCommand.Importance, rightCommand.Importance); Assert.Equal(leftCommand.TaskName, rightCommand.TaskName); break; case LoggingEventType.TaskFinishedEvent: TaskFinishedEventArgs leftTaskFinished = left.NodeBuildEvent.Value.Value as TaskFinishedEventArgs; TaskFinishedEventArgs rightTaskFinished = right.NodeBuildEvent.Value.Value as TaskFinishedEventArgs; Assert.NotNull(leftTaskFinished); Assert.NotNull(rightTaskFinished); Assert.Equal(leftTaskFinished.ProjectFile, rightTaskFinished.ProjectFile); Assert.Equal(leftTaskFinished.Succeeded, rightTaskFinished.Succeeded); Assert.Equal(leftTaskFinished.TaskFile, rightTaskFinished.TaskFile); Assert.Equal(leftTaskFinished.TaskName, rightTaskFinished.TaskName); break; case LoggingEventType.TaskStartedEvent: TaskStartedEventArgs leftTaskStarted = left.NodeBuildEvent.Value.Value as TaskStartedEventArgs; TaskStartedEventArgs rightTaskStarted = right.NodeBuildEvent.Value.Value as TaskStartedEventArgs; Assert.NotNull(leftTaskStarted); Assert.NotNull(rightTaskStarted); Assert.Equal(leftTaskStarted.ProjectFile, rightTaskStarted.ProjectFile); Assert.Equal(leftTaskStarted.TaskFile, rightTaskStarted.TaskFile); Assert.Equal(leftTaskStarted.TaskName, rightTaskStarted.TaskName); break; default: Assert.True(false, string.Format("Unexpected logging event type {0}", left.EventType)); break; } }
public void LogWarningEvent(BuildWarningEventArgs e) { WarningEvents.Add(e); }
void IBuildEngine.LogWarningEvent(BuildWarningEventArgs e) => LogWarningEvents.Add(e);
void source_WarningRaised(object sender, BuildWarningEventArgs e) { this.warnings.Add(e); }
private void EventSource_WarningRaised(object sender, BuildWarningEventArgs e) { this.Warnings.Add(e); }
private void Log(BuildWarningEventArgs eventArgs) { Messages.Add($"WARNING: {eventArgs.Message}"); }
void IBuildEngine.LogWarningEvent(BuildWarningEventArgs e) { Console.WriteLine("BuildEngine: WARNING: {0}", e.Message); this.warnings.Add(e); }
private void BuildWarning(object sender, BuildWarningEventArgs e) { SendMessage(FormatMessage(e)); }
public void LogWarningEvent(BuildWarningEventArgs e) { _log.LogWarning(e.Message); }
public void LogWarningEvent(BuildWarningEventArgs e) { Console.WriteLine(LogFormat, "WARNING", e.Message); }
public void LogWarningEvent(BuildWarningEventArgs e) { }
void IBuildEngine.LogWarningEvent(BuildWarningEventArgs e) { this.Output.WriteLine($"Warning: {e.Message}"); }
public void LogWarningEvent(BuildWarningEventArgs e) { Logger.WarningsEvents.Add(e); }
public void LogWarningEvent(BuildWarningEventArgs e) { Warnings.Add(e.Message); }
/// <summary> /// This is the delegate for warning events. /// </summary> protected virtual void WarningHandler(object sender, BuildWarningEventArgs warningEvent) { // NOTE: This may run on a background thread! QueueOutputText(MessageImportance.High, GetFormattedErrorMessage(warningEvent.File, warningEvent.LineNumber, warningEvent.ColumnNumber, true, warningEvent.Code, warningEvent.Message)); QueueTaskEvent(warningEvent); }
/* * Method: LoggerEventHandler * * Receives build events and logs them the way we like. * */ internal void LoggerEventHandler(object sender, BuildEventArgs eventArgs) { if (eventArgs is BuildWarningEventArgs) { BuildWarningEventArgs w = (BuildWarningEventArgs)eventArgs; // hack: disregard the MTA warning. // need the second condition to pass on ploc builds if (w.Code != "MSB4056" && !w.Message.Contains("MSB4056")) { fullLog.AppendFormat("{0}({1},{2}): {3} warning {4}: {5}\r\n", w.File, w.LineNumber, w.ColumnNumber, w.Subcategory, w.Code, w.Message); ++warningCount; this.warnings.Add(w); } } else if (eventArgs is BuildErrorEventArgs) { BuildErrorEventArgs e = (BuildErrorEventArgs)eventArgs; fullLog.AppendFormat("{0}({1},{2}): {3} error {4}: {5}\r\n", e.File, e.LineNumber, e.ColumnNumber, e.Subcategory, e.Code, e.Message); ++errorCount; this.errors.Add(e); } else { // Log the message unless we are a build finished event and logBuildFinished is set to false. bool logMessage = !(eventArgs is BuildFinishedEventArgs) || (eventArgs is BuildFinishedEventArgs && logBuildFinishedEvent); if (logMessage) { fullLog.Append(eventArgs.Message); fullLog.Append("\r\n"); } } if (eventArgs is ExternalProjectStartedEventArgs) { this.ExternalProjectStartedEvents.Add((ExternalProjectStartedEventArgs)eventArgs); } else if (eventArgs is ExternalProjectFinishedEventArgs) { this.ExternalProjectFinishedEvents.Add((ExternalProjectFinishedEventArgs)eventArgs); } if (eventArgs is BuildFinishedEventArgs) { buildFinishedEvents.Add((BuildFinishedEventArgs)eventArgs); // We should not have any task crashes. Sometimes a test will validate that their expected error // code appeared, but not realize it then crashed. AssertLogDoesntContain("MSB4018"); // We should not have any Engine crashes. AssertLogDoesntContain("MSB0001"); // Console.Write in the context of a unit test is very expensive. A hundred // calls to Console.Write can easily take two seconds on a fast machine. Therefore, only // do the Console.Write once at the end of the build. Console.Write(FullLog); } }
/////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////// void eventSource_WarningRaised(object sender, BuildWarningEventArgs e) { LogBuildEventArgs(e, "WarningRaised"); }
void OnWarning(object sender, BuildWarningEventArgs e) { AppendError(e.File, e.LineNumber, e.ColumnNumber, e.Code, e.Message, e.ProjectFile, e.Subcategory, e.HelpKeyword, true); }
public void LogWarningEvent(BuildWarningEventArgs e) { _warningCount++; _warningLog.AppendLine(e.Message); Console.WriteLine("Warning: {0}", e.Message); }
public void LogWarningEvent(BuildWarningEventArgs e) { throw new NotImplementedException(); }
private void Log(BuildWarningEventArgs eventArgs) { Messages.Add(String.Format("WARNING: {0}", eventArgs.Message)); }
protected void warningRaised(object sender, BuildWarningEventArgs e) { Log.Warn("[.targets:{0}]: {1} - '{2}'", e.LineNumber, e.Code, e.Message); }
void eventSource_WarningRaised(object sender, BuildWarningEventArgs e) { BuildWarning warning = new BuildWarning() { File = e.File, Timestamp = e.Timestamp, LineNumber = e.LineNumber, ColumnNumber = e.ColumnNumber, Code = e.Code, Message = e.Message, }; Warnings.Add(warning); }
public abstract void WarningHandler(object sender, BuildWarningEventArgs e);
void eventSource_WarningRaised(object sender, BuildWarningEventArgs e) { LogErrorOrWarning(XmlLoggerElements.Warning, e.Message, e.Code, e.File, e.LineNumber, e.ColumnNumber, e.Timestamp); }
public virtual void LogWarningEvent(BuildWarningEventArgs eventArgs) { warnings.Add(eventArgs); }
public void TestSkipInvalidConfigurationsCase() { string tmpFileName = Path.GetTempFileName(); File.Delete(tmpFileName); string projectFilePath = tmpFileName + ".sln"; string solutionContents = @" Microsoft Visual Studio Solution File, Format Version 9.00 # Visual Studio 2005 Project('{E24C65DC-7377-472B-9ABA-BC803B73C61A}') = 'C:\solutions\WebSite2\', '..\..\solutions\WebSite2\', '{F90528C4-6989-4D33-AFE8-F53173597CC2}' ProjectSection(WebsiteProperties) = preProject Debug.AspNetCompiler.VirtualPath = '/WebSite2' Debug.AspNetCompiler.PhysicalPath = '..\..\solutions\WebSite2\' Debug.AspNetCompiler.TargetPath = 'PrecompiledWeb\WebSite2\' Debug.AspNetCompiler.Updateable = 'true' Debug.AspNetCompiler.ForceOverwrite = 'true' Debug.AspNetCompiler.FixedNames = 'true' Debug.AspNetCompiler.Debug = 'True' Release.AspNetCompiler.VirtualPath = '/WebSite2' Release.AspNetCompiler.PhysicalPath = '..\..\solutions\WebSite2\' Release.AspNetCompiler.TargetPath = 'PrecompiledWeb\WebSite2\' Release.AspNetCompiler.Updateable = 'true' Release.AspNetCompiler.ForceOverwrite = 'true' Release.AspNetCompiler.FixedNames = 'true' Release.AspNetCompiler.Debug = 'False' VWDPort = '2776' DefaultWebSiteLanguage = 'Visual C#' EndProjectSection EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {F90528C4-6989-4D33-AFE8-F53173597CC2}.Debug|Any CPU.ActiveCfg = Debug|.NET {F90528C4-6989-4D33-AFE8-F53173597CC2}.Debug|Any CPU.Build.0 = Debug|.NET EndGlobalSection EndGlobal"; File.WriteAllText(projectFilePath, solutionContents.Replace('\'', '"')); try { MockLogger logger = new MockLogger(); Engine engine = new Engine(); engine.RegisterLogger(logger); Project solutionWrapperProject = new Project(engine); solutionWrapperProject.Load(projectFilePath); solutionWrapperProject.SetProperty("Configuration", "Nonexistent"); solutionWrapperProject.SetProperty("SkipInvalidConfigurations", "true"); solutionWrapperProject.ToolsVersion = "4.0"; // Build should complete successfully even with an invalid solution config if SkipInvalidConfigurations is true Assertion.AssertEquals(true, solutionWrapperProject.Build(null, null)); // We should get the invalid solution configuration warning Assertion.AssertEquals(1, logger.Warnings.Count); BuildWarningEventArgs warning = logger.Warnings[0]; // Don't look at warning.Code here -- it may be null if PseudoLoc has messed // with our resource strings. The code will still be in the log -- it just wouldn't get // pulled out into the code field. logger.AssertLogContains("MSB4126"); // No errors expected Assertion.AssertEquals(0, logger.Errors.Count); } finally { File.Delete(projectFilePath); } }