public void StatusEventRaised(object sender, BuildStatusEventArgs e)
 {
     try
     {
         lock (syncLock)
         {
             // This happens when we consume args created by us (deserialized)
             if (e is ProjectEvaluationStartedEventArgs projectEvaluationStarted)
             {
                 var projectName = projectEvaluationStarted.ProjectFile;
                 var project     = EvaluationFolder.GetOrCreateNodeWithName <Project>(projectName);
                 project.Id = e.BuildEventContext.ProjectContextId;
             }
             else if (e is ProjectEvaluationFinishedEventArgs projectEvaluationFinished)
             {
             }
             // this happens during live build using MSBuild 15.3 or newer
             else if (e.GetType().Name == "ProjectEvaluationStartedEventArgs")
             {
                 var projectName = Utilities.ParseQuotedSubstring(e.Message);
                 var project     = EvaluationFolder.GetOrCreateNodeWithName <Project>(projectName);
                 project.Id = Reflector.GetEvaluationId(e.BuildEventContext);
             }
         }
     }
     catch (Exception ex)
     {
         HandleException(ex);
     }
 }
 public void StatusEventRaised(object sender, BuildStatusEventArgs e)
 {
     try
     {
         lock (syncLock)
         {
             if (e is ProjectEvaluationStartedEventArgs projectEvaluationStarted)
             {
                 var projectName = projectEvaluationStarted.ProjectFile;
                 var project     = EvaluationFolder.GetOrCreateNodeWithName <Project>(projectName);
                 project.Id = e.BuildEventContext.ProjectContextId;
             }
             else if (e is ProjectEvaluationFinishedEventArgs projectEvaluationFinished)
             {
             }
             else if (e.Message.StartsWith("Evaluation started"))
             {
                 var projectName = Utilities.ParseQuotedSubstring(e.Message);
                 var project     = EvaluationFolder.GetOrCreateNodeWithName <Project>(projectName);
                 project.Id = e.BuildEventContext.ProjectContextId;
             }
         }
     }
     catch (Exception ex)
     {
         HandleException(ex);
     }
 }
Beispiel #3
0
        public void StatusEventRaised(object sender, BuildStatusEventArgs e)
        {
            try
            {
                lock (syncLock)
                {
                    // This happens when we consume args created by us (deserialized)
                    if (e is ProjectEvaluationStartedEventArgs projectEvaluationStarted)
                    {
                        EvaluationFolder = Build.GetOrCreateNodeWithName <Folder>(Intern("Evaluation"));

                        var evaluationId = -e.BuildEventContext.ProjectContextId;
                        var projectName  = Intern(projectEvaluationStarted.ProjectFile);
                        var nodeName     = Intern(GetEvaluationProjectName(evaluationId, projectName));
                        var project      = EvaluationFolder.GetOrCreateNodeWithName <Project>(nodeName);
                        if (project.ProjectFile == null)
                        {
                            project.ProjectFile = projectName;
                        }

                        // we stash the evaluation Id as a negative ProjectContextId
                        project.Id = evaluationId;
                    }
                    else if (e is ProjectEvaluationFinishedEventArgs projectEvaluationFinished)
                    {
                        EvaluationFolder = Build.GetOrCreateNodeWithName <Folder>("Evaluation");

                        var projectName    = Intern(projectEvaluationFinished.ProjectFile);
                        var profilerResult = projectEvaluationFinished.ProfilerResult;
                        if (profilerResult != null && projectName != null)
                        {
                            var nodeName = Intern(GetEvaluationProjectName(-projectEvaluationFinished.BuildEventContext.ProjectContextId, projectName));
                            var project  = EvaluationFolder.GetOrCreateNodeWithName <Project>(nodeName);
                            ConstructProfilerResult(project, profilerResult.Value);
                        }
                    }
                    // this happens during live build using MSBuild 15.3 or newer
                    else if (e.GetType().Name == "ProjectEvaluationStartedEventArgs")
                    {
                        var projectName = Intern(TextUtilities.ParseQuotedSubstring(e.Message));
                        var nodeName    = Intern(GetEvaluationProjectName(-e.BuildEventContext.ProjectContextId, projectName));
                        var project     = EvaluationFolder.GetOrCreateNodeWithName <Project>(nodeName);
                        project.Id = Reflector.GetEvaluationId(e.BuildEventContext);
                        if (project.ProjectFile == null)
                        {
                            project.ProjectFile = projectName;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                HandleException(ex);
            }
        }