Пример #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Task"/> class.
 /// </summary>
 /// <param name="name">The name of the task.</param>
 /// <param name="taskStartedEvent">The <see cref="TaskStartedEventArgs"/> instance containing the event data.</param>
 /// <param name="assembly">The assembly from which the task originated.</param>
 public Task(string name, TaskStartedEventArgs taskStartedEvent, string assembly)
 {
     Name = name;
     Id = taskStartedEvent.BuildEventContext.TaskId;
     StartTime = taskStartedEvent.Timestamp;
     _fromAssembly = assembly;
 }
Пример #2
0
        public void VerifyEventType()
        {
            BuildFinishedEventArgs buildFinished = new BuildFinishedEventArgs("Message", "Keyword", true);
            BuildStartedEventArgs buildStarted = new BuildStartedEventArgs("Message", "Help");
            BuildMessageEventArgs lowMessage = new BuildMessageEventArgs("Message", "help", "sender", MessageImportance.Low);
            TaskStartedEventArgs taskStarted = new TaskStartedEventArgs("message", "help", "projectFile", "taskFile", "taskName");
            TaskFinishedEventArgs taskFinished = new TaskFinishedEventArgs("message", "help", "projectFile", "taskFile", "taskName", true);
            TaskCommandLineEventArgs commandLine = new TaskCommandLineEventArgs("commandLine", "taskName", MessageImportance.Low);
            BuildWarningEventArgs warning = new BuildWarningEventArgs("SubCategoryForSchemaValidationErrors", "MSB4000", "file", 1, 2, 3, 4, "message", "help", "sender");
            BuildErrorEventArgs error = new BuildErrorEventArgs("SubCategoryForSchemaValidationErrors", "MSB4000", "file", 1, 2, 3, 4, "message", "help", "sender");
            TargetStartedEventArgs targetStarted = new TargetStartedEventArgs("message", "help", "targetName", "ProjectFile", "targetFile");
            TargetFinishedEventArgs targetFinished = new TargetFinishedEventArgs("message", "help", "targetName", "ProjectFile", "targetFile", true);
            ProjectStartedEventArgs projectStarted = new ProjectStartedEventArgs(-1, "message", "help", "ProjectFile", "targetNames", null, null, null);
            ProjectFinishedEventArgs projectFinished = new ProjectFinishedEventArgs("message", "help", "ProjectFile", true);
            ExternalProjectStartedEventArgs externalStartedEvent = new ExternalProjectStartedEventArgs("message", "help", "senderName", "projectFile", "targetNames");

            VerifyLoggingPacket(buildFinished, LoggingEventType.BuildFinishedEvent);
            VerifyLoggingPacket(buildStarted, LoggingEventType.BuildStartedEvent);
            VerifyLoggingPacket(lowMessage, LoggingEventType.BuildMessageEvent);
            VerifyLoggingPacket(taskStarted, LoggingEventType.TaskStartedEvent);
            VerifyLoggingPacket(taskFinished, LoggingEventType.TaskFinishedEvent);
            VerifyLoggingPacket(commandLine, LoggingEventType.TaskCommandLineEvent);
            VerifyLoggingPacket(warning, LoggingEventType.BuildWarningEvent);
            VerifyLoggingPacket(error, LoggingEventType.BuildErrorEvent);
            VerifyLoggingPacket(targetStarted, LoggingEventType.TargetStartedEvent);
            VerifyLoggingPacket(targetFinished, LoggingEventType.TargetFinishedEvent);
            VerifyLoggingPacket(projectStarted, LoggingEventType.ProjectStartedEvent);
            VerifyLoggingPacket(projectFinished, LoggingEventType.ProjectFinishedEvent);
            VerifyLoggingPacket(externalStartedEvent, LoggingEventType.CustomEvent);
        }
 public void EventArgsCtors()
 {
     TaskStartedEventArgs taskStartedEvent = new TaskStartedEventArgs2();
     taskStartedEvent = new TaskStartedEventArgs("Message", "HelpKeyword", "ProjectFile", "TaskFile", "TaskName");
     taskStartedEvent = new TaskStartedEventArgs("Message", "HelpKeyword", "ProjectFile", "TaskFile", "TaskName", DateTime.Now);
     taskStartedEvent = new TaskStartedEventArgs(null, null, null, null, null);
     taskStartedEvent = new TaskStartedEventArgs(null, null, null, null, null, DateTime.Now);
 }
Пример #4
0
 public BuildMessage(TaskStartedEventArgs args)
 {
     EventType = args.GetType().Name.Replace("EventArgs", "");
     Message = args.Message;
     ProjectFile = args.ProjectFile;
     TaskFile = args.TaskFile;
     TaskName = args.TaskName;
     HelpKeyword = args.HelpKeyword;
     SenderName = args.SenderName;
     Timestamp = args.Timestamp;
     ThreadId = args.ThreadId;
 }
		public void AssignmentTest ()
		{
			TaskStartedEventArgs tsea;
			string message = "message";
			string helpKeyword = "helpKeyword";
			string projectFile = "projectFile";
			string taskFile = "taskFile";
			string taskName = "taskName";
			
			tsea = new TaskStartedEventArgs (message, helpKeyword, projectFile, taskFile, taskName);
			
			Assert.AreEqual (message, tsea.Message, "Message");
			Assert.AreEqual (helpKeyword, tsea.HelpKeyword, "HelpKeyword");
			Assert.AreEqual (projectFile, tsea.ProjectFile, "ProjectFile");
			Assert.AreEqual (taskFile, tsea.TaskFile, "TaskFile");
			Assert.AreEqual (taskName, tsea.TaskName, "TaskName");
		}
Пример #6
0
        /// <summary>
        /// Handler for task started events
        /// </summary>
        /// <param name="sender">sender (should be null)</param>
        /// <param name="e">event arguments</param>
        public void TaskStartedHandler(object sender, TaskStartedEventArgs e)
        {
            InitializeBaseConsoleLogger(); // for compat: see DDB#136924

            _consoleLogger.TaskStartedHandler(sender, e);
        }
Пример #7
0
 private void eventSource_TaskStarted(object sender, TaskStartedEventArgs e)
 {
     if (stop) {
         return;
     }
     Execute(new BuildMessage(e));
     if (stop) {
         KillThyself();
     }
 }
Пример #8
0
 private void OnTaskStarted(object sender, TaskStartedEventArgs eventArgs)
 {
     // TaskStartedEventArgs adds ProjectFile, TaskFile, TaskName
     // To keep this log clean, this logger will ignore these events.
 }
Пример #9
0
 private void eventSource_TaskStarted(object sender, Microsoft.Build.Framework.TaskStartedEventArgs e)
 {
     textBox.Text += Environment.NewLine + e.Message;
 }
Пример #10
0
 /// <summary>
 /// This is the delegate for TaskStartedHandler events.
 /// </summary>
 protected virtual void TaskStartedHandler(object sender, TaskStartedEventArgs buildEvent)
 {
     // NOTE: This may run on a background thread!
     QueueOutputEvent(MessageImportance.Low, buildEvent);
     IndentOutput();
 }
Пример #11
0
 public abstract void TaskStartedHandler(object sender, TaskStartedEventArgs e);
 private void TaskStarted(object sender, TaskStartedEventArgs e)
 {
     string line = string.Format(CultureInfo.InvariantCulture, "{0}", e.Message);
     this.WriteLine(line);
 }
			void OnTaskStarted(object sender, TaskStartedEventArgs e)
			{
				if (desc.taskname.Equals(e.TaskName, StringComparison.OrdinalIgnoreCase)) {
					CreateBaseLogger();
					if (baseLogger != null) {
						baseLogger.Initialize(eventSource);
						isActive = true;
					}
				}
			}
 /// <summary>
 /// Compare two TaskStarted events
 /// </summary>
 private static void VerifyTaskStarted(TaskStartedEventArgs genericEvent, TaskStartedEventArgs newGenericEvent)
 {
     Assert.IsTrue(string.Compare(genericEvent.TaskFile, newGenericEvent.TaskFile, StringComparison.OrdinalIgnoreCase) == 0, "Expected TaskFile to Match");
     Assert.IsTrue(string.Compare(genericEvent.ProjectFile, newGenericEvent.ProjectFile, StringComparison.OrdinalIgnoreCase) == 0, "Expected ProjectFile to Match");
     Assert.IsTrue(string.Compare(genericEvent.TaskName, newGenericEvent.TaskName, StringComparison.OrdinalIgnoreCase) == 0, "Expected TaskName to Match");
 }
Пример #15
0
        /// <summary>
        /// Compare this build event context with another object to determine 
        /// equality. This means the values inside the object are identical.
        /// </summary>
        /// <param name="obj">Object to compare to this object</param>
        /// <returns>True if the object values are identical, false if they are not identical</returns>
        public static bool IsEquivalent(TaskStartedEventArgs args, TaskStartedEventArgs other)
        {
            if (!String.Equals(args.ProjectFile, other.ProjectFile, StringComparison.OrdinalIgnoreCase))
            {
                return false;
            }

            if (!String.Equals(args.TaskFile, other.TaskFile, StringComparison.OrdinalIgnoreCase))
            {
                return false;
            }

            if (!String.Equals(args.TaskName, other.TaskName, StringComparison.OrdinalIgnoreCase))
            {
                return false;
            }

            return ((BuildEventArgs)args).IsEquivalent(other);
        }
        public void TestTaskStartedEventArgs()
        {
            // Test using reasonable values
            TaskStartedEventArgs genericEvent = new TaskStartedEventArgs("Message", "HelpKeyword", "ProjectFile", "TaskFile", "TaskName");
            genericEvent.BuildEventContext = new BuildEventContext(5, 4, 3, 2);

            // Serialize
            genericEvent.WriteToStream(_writer);
            long streamWriteEndPosition = _stream.Position;

            // Deserialize and Verify
            _stream.Position = 0;
            TaskStartedEventArgs newGenericEvent = new TaskStartedEventArgs(null, null, null, null, null);
            newGenericEvent.CreateFromStream(_reader, _eventArgVersion);
            long streamReadEndPosition = _stream.Position;
            Assert.IsTrue(streamWriteEndPosition == streamReadEndPosition, "Stream End Positions Should Match");
            VerifyGenericEventArg(genericEvent, newGenericEvent);
            VerifyTaskStarted(genericEvent, newGenericEvent);

            _stream.Position = 0;
            // Make sure empty strings are passed correctly
            genericEvent = new TaskStartedEventArgs(string.Empty, string.Empty, string.Empty, string.Empty, string.Empty);
            genericEvent.BuildEventContext = new BuildEventContext(5, 4, 3, 2);

            // Serialize
            genericEvent.WriteToStream(_writer);
            streamWriteEndPosition = _stream.Position;

            // Deserialize and Verify
            _stream.Position = 0;
            newGenericEvent = new TaskStartedEventArgs(null, null, null, null, null);
            newGenericEvent.CreateFromStream(_reader, _eventArgVersion);
            streamReadEndPosition = _stream.Position;
            Assert.IsTrue(streamWriteEndPosition == streamReadEndPosition, "Stream End Positions Should Match");
            VerifyGenericEventArg(genericEvent, newGenericEvent);
            VerifyTaskStarted(genericEvent, newGenericEvent);

            // Test using null strings
            _stream.Position = 0;
            // Make sure null string are passed correctly
            genericEvent = new TaskStartedEventArgs(null, null, null, null, null);
            genericEvent.BuildEventContext = null;

            // Serialize
            genericEvent.WriteToStream(_writer);
            streamWriteEndPosition = _stream.Position;

            // Deserialize and Verify
            _stream.Position = 0;
            newGenericEvent = new TaskStartedEventArgs("Something", "Something", "Something", "Something", "Something");
            newGenericEvent.CreateFromStream(_reader, _eventArgVersion);
            streamReadEndPosition = _stream.Position;
            Assert.IsTrue(streamWriteEndPosition == streamReadEndPosition, "Stream End Positions Should Match");
            VerifyGenericEventArg(genericEvent, newGenericEvent);
            VerifyTaskStarted(genericEvent, newGenericEvent);
        }
Пример #17
0
			// registered when only specific tasks should be forwarded
			void OnTaskStarted(object sender, TaskStartedEventArgs e)
			{
				if (program.currentJob.InterestingTaskNames.Contains(e.TaskName))
					OnEvent(sender, e);
			}
Пример #18
0
        /// <summary>
        /// Handler for task started events
        /// </summary>
        /// <param name="sender">sender (should be null)</param>
        /// <param name="e">event arguments</param>
        public override void TaskStartedHandler(object sender, TaskStartedEventArgs e)
        {
            // if verbosity is detailed or diagnostic
            if (IsVerbosityAtLeast(LoggerVerbosity.Detailed))
            {
                setColor(ConsoleColor.Cyan);
                WriteLinePretty(e.Message);
                resetColor();
            }

            if (this.showPerfSummary)
            {
                PerformanceCounter counter = GetPerformanceCounter(e.TaskName, ref taskPerformanceCounters);

                // Place the counter "in scope" meaning the task is executing right now.
                counter.InScope = true;
            }

            // Bump up the overall number of indents, so that anything within this task will show up
            // indented.
            this.currentIndentLevel++;
        }
Пример #19
0
        void TaskStarted(object sender, TaskStartedEventArgs e)
        {
            buildTypeList.Push(BuildType.Task);

            XmlElement taskElemet = xmlDoc.CreateElement("Task");
            taskElements.Push(taskElemet);
            targetElements.Peek().AppendChild(taskElemet);

            taskElemet.Attributes.Append(CreateStartedAttribute(e.Timestamp));

            taskElemet.Attributes.Append(CreateAttribute("Name", e.TaskName));
        }
 public TaskExecutionInfo(TaskStartedEventArgs startedArgs, TaskFinishedEventArgs finishedArgs)
 {
     this.Name = startedArgs.TaskName;
     this.TimeSpent = finishedArgs.Timestamp.Subtract(startedArgs.Timestamp);
 }
Пример #21
0
        public void TestLoggingEventCustomerSerialization()
        {
            Hashtable loggingTypeCacheWrites = new Hashtable();
            stream.Position = 0;
            BuildEventContext context = new BuildEventContext(1,3,5,7);
            GenericBuildEventArg genericBuildEvent = new GenericBuildEventArg("Message","Help","Sender");
            genericBuildEvent.BuildEventContext = context;
            NodeLoggingEvent genericBuildEventLoggingEvent = new NodeLoggingEvent(genericBuildEvent);
            genericBuildEventLoggingEvent.WriteToStream(writer, loggingTypeCacheWrites);

            GenericCustomBuildEventArg genericCustomEvent = new GenericCustomBuildEventArg("FooFighter");
            genericCustomEvent.BuildEventContext = context;
            NodeLoggingEvent genericCustomEventLoggingEvent = new NodeLoggingEvent(genericCustomEvent);
            genericCustomEventLoggingEvent.WriteToStream(writer, loggingTypeCacheWrites);

            BuildErrorEventArgs errorEvent = new BuildErrorEventArgs("Subcategory", "Code", "File", 1, 2, 3, 4, "Message", "HelpKeyword", "SenderName");
            errorEvent.BuildEventContext = context;
            NodeLoggingEvent errorEventLoggingEvent = new NodeLoggingEvent(errorEvent);
            errorEventLoggingEvent.WriteToStream(writer, loggingTypeCacheWrites);

            BuildMessageEventArgs messageEvent = new BuildMessageEventArgs("Message", "HelpKeyword", "SenderName",MessageImportance.High);
            messageEvent.BuildEventContext = context;
            NodeLoggingEvent messageEventLoggingEvent = new NodeLoggingEvent(messageEvent);
            messageEventLoggingEvent.WriteToStream(writer, loggingTypeCacheWrites);

            BuildWarningEventArgs warningEvent = new BuildWarningEventArgs("Subcategory", "Code", "File", 1, 2, 3, 4, "Message", "HelpKeyword", "SenderName");
            warningEvent.BuildEventContext = context;
            NodeLoggingEvent warningEventLoggingEvent = new NodeLoggingEvent(warningEvent);
            warningEventLoggingEvent.WriteToStream(writer, loggingTypeCacheWrites);

            ProjectStartedEventArgs projectStartedEvent = new ProjectStartedEventArgs( 8,"Message", "HelpKeyword", "ProjectFile", "TargetNames", null, null, new BuildEventContext(7,8,9,10));
            projectStartedEvent.BuildEventContext = context;
            NodeLoggingEvent projectStartedEventLoggingEvent = new NodeLoggingEvent(projectStartedEvent);
            projectStartedEventLoggingEvent.WriteToStream(writer, loggingTypeCacheWrites);

            ProjectFinishedEventArgs projectFinishedEvent = new ProjectFinishedEventArgs("Message", "HelpKeyword","ProjectFile",true);
            projectFinishedEvent.BuildEventContext = context;
            NodeLoggingEvent projectFinishedEventLoggingEvent = new NodeLoggingEvent(projectFinishedEvent);
            projectFinishedEventLoggingEvent.WriteToStream(writer, loggingTypeCacheWrites);

            TargetStartedEventArgs targetStartedEvent = new TargetStartedEventArgs("Message", "HelpKeyword", "TargetName", "ProjectFile", "TargetFile");
            targetStartedEvent.BuildEventContext = context;
            NodeLoggingEvent targetStartedEventLoggingEvent = new NodeLoggingEvent(targetStartedEvent);
            targetStartedEventLoggingEvent.WriteToStream(writer, loggingTypeCacheWrites);

            TargetFinishedEventArgs targetFinished = new TargetFinishedEventArgs("Message", "HelpKeyword","TargetName", "ProjectFile", "TargetFile", true);
            targetFinished.BuildEventContext = context;
            NodeLoggingEvent targetFinishedEventLoggingEvent = new NodeLoggingEvent(targetFinished);
            targetFinishedEventLoggingEvent.WriteToStream(writer, loggingTypeCacheWrites);

            TaskStartedEventArgs taskStartedEvent = new TaskStartedEventArgs("Message", "HelpKeyword", "ProjectFile", "TaskFile", "TaskName");
            taskStartedEvent.BuildEventContext = context;
            NodeLoggingEvent taskStartedEventLoggingEvent = new NodeLoggingEvent(taskStartedEvent);
            taskStartedEventLoggingEvent.WriteToStream(writer, loggingTypeCacheWrites);

            TaskFinishedEventArgs taskFinishedEvent = new TaskFinishedEventArgs("Message", "HelpKeyword", "ProjectFile", "TaskFile", "TaskName", true);
            taskFinishedEvent.BuildEventContext = context;
            NodeLoggingEvent taskFinishedEventLoggingEvent = new NodeLoggingEvent(taskFinishedEvent);
            taskFinishedEventLoggingEvent.WriteToStream(writer, loggingTypeCacheWrites);

            BuildFinishedEventArgs buildFinishedEvent = new BuildFinishedEventArgs("Message","Help",true);
            buildFinishedEvent.BuildEventContext = context;
            NodeLoggingEvent buildFinishedEventEventLoggingEvent = new NodeLoggingEvent(buildFinishedEvent);
            buildFinishedEventEventLoggingEvent.WriteToStream(writer, loggingTypeCacheWrites);

            BuildStartedEventArgs buildStartedEvent = new BuildStartedEventArgs("Message","Help");
            buildStartedEvent.BuildEventContext = context;
            NodeLoggingEvent buildStartedEventLoggingEvent = new NodeLoggingEvent(buildStartedEvent);
            buildStartedEventLoggingEvent.WriteToStream(writer, loggingTypeCacheWrites);

            TaskCommandLineEventArgs commandlineEventArg = new TaskCommandLineEventArgs("CommandLine","TaskName", MessageImportance.High);
            commandlineEventArg.BuildEventContext = context;
            NodeLoggingEvent commandlineEventArgLoggingEvent = new NodeLoggingEvent(commandlineEventArg);
            commandlineEventArgLoggingEvent.WriteToStream(writer, loggingTypeCacheWrites);

            Hashtable loggingTypeCacheReads = new Hashtable();
            long streamWriteEndPosition = stream.Position;
            stream.Position = 0;

            NodeLoggingEvent nodeLoggingEvent = new NodeLoggingEvent(null);
            nodeLoggingEvent.CreateFromStream(reader, loggingTypeCacheReads);
            Assert.IsTrue(nodeLoggingEvent.BuildEvent.GetType() == typeof(GenericBuildEventArg));

            nodeLoggingEvent = new NodeLoggingEvent(null);
            nodeLoggingEvent.CreateFromStream(reader, loggingTypeCacheReads);
            Assert.IsTrue(nodeLoggingEvent.BuildEvent.GetType() == typeof(GenericCustomBuildEventArg));

            nodeLoggingEvent = new NodeLoggingEvent(null);
            nodeLoggingEvent.CreateFromStream(reader, loggingTypeCacheReads);
            Assert.IsTrue(nodeLoggingEvent.BuildEvent.GetType() == typeof(BuildErrorEventArgs));

            nodeLoggingEvent = new NodeLoggingEvent(null);
            nodeLoggingEvent.CreateFromStream(reader, loggingTypeCacheReads);
            Assert.IsTrue(nodeLoggingEvent.BuildEvent.GetType() == typeof(BuildMessageEventArgs));

            nodeLoggingEvent = new NodeLoggingEvent(null);
            nodeLoggingEvent.CreateFromStream(reader, loggingTypeCacheReads);
            Assert.IsTrue(nodeLoggingEvent.BuildEvent.GetType() == typeof(BuildWarningEventArgs));

            nodeLoggingEvent = new NodeLoggingEvent(null);
            nodeLoggingEvent.CreateFromStream(reader, loggingTypeCacheReads);
            Assert.IsTrue(nodeLoggingEvent.BuildEvent.GetType() == typeof(ProjectStartedEventArgs));

            nodeLoggingEvent = new NodeLoggingEvent(null);
            nodeLoggingEvent.CreateFromStream(reader, loggingTypeCacheReads);
            Assert.IsTrue(nodeLoggingEvent.BuildEvent.GetType() == typeof(ProjectFinishedEventArgs));

            nodeLoggingEvent = new NodeLoggingEvent(null);
            nodeLoggingEvent.CreateFromStream(reader, loggingTypeCacheReads);
            Assert.IsTrue(nodeLoggingEvent.BuildEvent.GetType() == typeof(TargetStartedEventArgs));


            nodeLoggingEvent = new NodeLoggingEvent(null);
            nodeLoggingEvent.CreateFromStream(reader, loggingTypeCacheReads);
            Assert.IsTrue(nodeLoggingEvent.BuildEvent.GetType() == typeof(TargetFinishedEventArgs));

            nodeLoggingEvent = new NodeLoggingEvent(null);
            nodeLoggingEvent.CreateFromStream(reader, loggingTypeCacheReads);
            Assert.IsTrue(nodeLoggingEvent.BuildEvent.GetType() == typeof(TaskStartedEventArgs));

            nodeLoggingEvent = new NodeLoggingEvent(null);
            nodeLoggingEvent.CreateFromStream(reader, loggingTypeCacheReads);
            Assert.IsTrue(nodeLoggingEvent.BuildEvent.GetType() == typeof(TaskFinishedEventArgs));

            nodeLoggingEvent = new NodeLoggingEvent(null);
            nodeLoggingEvent.CreateFromStream(reader, loggingTypeCacheReads);
            Assert.IsTrue(nodeLoggingEvent.BuildEvent.GetType() == typeof(BuildFinishedEventArgs));

            nodeLoggingEvent = new NodeLoggingEvent(null);
            nodeLoggingEvent.CreateFromStream(reader, loggingTypeCacheReads);
            Assert.IsTrue(nodeLoggingEvent.BuildEvent.GetType() == typeof(BuildStartedEventArgs));

            nodeLoggingEvent = new NodeLoggingEvent(null);
            nodeLoggingEvent.CreateFromStream(reader, loggingTypeCacheReads);
            Assert.IsTrue(nodeLoggingEvent.BuildEvent.GetType() ==typeof( TaskCommandLineEventArgs));
            
            long streamReadEndPosition = stream.Position;
            Assert.AreEqual(streamWriteEndPosition, streamReadEndPosition, "Expected Read and Write Positions to match");
        }
Пример #22
0
        /// <summary>
        /// Raises a "task execution started" event to all registered loggers.
        /// </summary>
        /// <param name="sender">sender of the event</param>
        /// <param name="buildEvent">TaskStartedEventArgs</param>
        /// <exception cref="LoggerException">When EventHandler raises an logger exception the LoggerException is rethrown</exception>
        /// <exception cref="InternalLoggerException">Any exceptions which are not LoggerExceptions are wrapped in an InternalLoggerException</exception>
        /// <exception cref="Exception">ExceptionHandling.IsCriticalException exceptions will not be wrapped</exception>
        private void RaiseTaskStartedEvent(object sender, TaskStartedEventArgs buildEvent)
        {
            if (TaskStarted != null)
            {
                try
                {
                    TaskStarted(sender, buildEvent);
                }
                catch (LoggerException)
                {
                    // if a logger has failed politely, abort immediately
                    // first unregister all loggers, since other loggers may receive remaining events in unexpected orderings
                    // if a fellow logger is throwing in an event handler.
                    this.UnregisterAllEventHandlers();
                    throw;
                }
                catch (Exception exception)
                {
                    // first unregister all loggers, since other loggers may receive remaining events in unexpected orderings
                    // if a fellow logger is throwing in an event handler.
                    this.UnregisterAllEventHandlers();

                    if (ExceptionHandling.IsCriticalException(exception))
                    {
                        throw;
                    }

                    InternalLoggerException.Throw(exception, buildEvent, "FatalErrorWhileLogging", false);
                }
            }

            RaiseStatusEvent(sender, buildEvent);
        }
Пример #23
0
 /// <summary>
 /// This is the delegate for TaskStartedHandler events.
 /// </summary>
 private void TaskStartedHandler(object sender, TaskStartedEventArgs buildEvent)
 {
     if (LogAtImportance(MessageImportance.Normal))
     {
         LogEvent(sender, buildEvent);
     }
     ++this.currentIndent;
 }
 private void TaskStarted(object sender, TaskStartedEventArgs e)
 {
     this.LogStarted("task", e.TaskName, e.ProjectFile);
 }
Пример #25
0
 void EventSource_TaskStarted(object sender, TaskStartedEventArgs e)
 {
     statistics.Add(new TaskIdentifier(e.BuildEventContext.NodeId, e.BuildEventContext.TaskId), new TaskInformation(e.TaskName, stopwatch.Elapsed));
 }
Пример #26
0
 /// <summary>
 /// Handle a task started event
 /// </summary>
 /// <param name="sender">Who sent the event</param>
 /// <param name="e">Event raised on the event source</param>
 private void Source_TaskStarted(object sender, TaskStartedEventArgs e)
 {
     HandleEvent(e);
 }
Пример #27
0
		/// <summary>
		/// This is the delegate for TaskStartedHandler events.
		/// </summary>
		private void TaskStartedHandler(object sender, TaskStartedEventArgs buildEvent)
		{
            try
            {
                if (LogAtImportance(MessageImportance.Normal))
                {
                    LogEvent(sender, buildEvent);
                }
            }
            catch (Exception e)
            {
                Debug.Assert(false, "Problem logging taskstarted event: " + e.Message + " at " + e.TargetSite);
                // swallow the exception
            }
            finally
            {
                ++this.currentIndent;
            }
		}
Пример #28
0
		void LogTaskStarted ()
		{
			TaskStartedEventArgs tsea = new TaskStartedEventArgs ("Task started.", null,
					parentTarget.Project.FullFileName,
					parentTarget.TargetFile, taskElement.Name);
			parentTarget.Project.ParentEngine.EventSource.FireTaskStarted (this, tsea);
		}
Пример #29
0
		private void eventSource_TaskStartedHandler(object sender, TaskStartedEventArgs e)
		{
            LogStageStarted(XmlLoggerElements.Task, e.TaskName, e.ProjectFile, e.Timestamp);
		}
Пример #30
0
 void TaskStarted(object sender, TaskStartedEventArgs e)
 {
 }
Пример #31
0
			void OnTaskStarted(object sender, TaskStartedEventArgs e)
			{
				activeTaskName = e.TaskName;
				if (MSBuildEngine.CompileTaskNames.Contains(e.TaskName.ToLowerInvariant())) {
					engine.OutputTextLine(StringParser.Parse("${res:MainWindow.CompilerMessages.CompileVerb} " + Path.GetFileNameWithoutExtension(e.ProjectFile)));
				}
			}
Пример #32
0
 private void eventSource_TaskStarted(object sender, Microsoft.Build.Framework.TaskStartedEventArgs e)
 {
     this.AddNode(e.Message);
 }