private ProjectLoggingContext( NodeLoggingContext nodeLoggingContext, int submissionId, int configurationId, string projectFullPath, List <string> targets, string toolsVersion, PropertyDictionary <ProjectPropertyInstance> projectProperties, ItemDictionary <ProjectItemInstance> projectItems, BuildEventContext parentBuildEventContext, int evaluationId, int projectContextId) : base(nodeLoggingContext) { _projectFullPath = projectFullPath; IEnumerable <DictionaryEntry> properties = null; IEnumerable <DictionaryEntry> items = null; string[] propertiesToSerialize = LoggingService.PropertiesToSerialize; // If we are only logging critical events lets not pass back the items or properties if (!LoggingService.OnlyLogCriticalEvents && !LoggingService.IncludeEvaluationPropertiesAndItems && (!LoggingService.RunningOnRemoteNode || LoggingService.SerializeAllProperties)) { properties = projectProperties?.GetCopyOnReadEnumerable(property => new DictionaryEntry(property.Name, property.EvaluatedValue)) ?? Enumerable.Empty <DictionaryEntry>(); items = projectItems?.GetCopyOnReadEnumerable(item => new DictionaryEntry(item.ItemType, new TaskItem(item))) ?? Enumerable.Empty <DictionaryEntry>(); } if (projectProperties != null && !LoggingService.IncludeEvaluationPropertiesAndItems && propertiesToSerialize?.Length > 0 && !LoggingService.SerializeAllProperties) { PropertyDictionary <ProjectPropertyInstance> projectPropertiesToSerialize = new PropertyDictionary <ProjectPropertyInstance>(); foreach (string propertyToGet in propertiesToSerialize) { ProjectPropertyInstance instance = projectProperties[propertyToGet]; { if (instance != null) { projectPropertiesToSerialize.Set(instance); } } } properties = projectPropertiesToSerialize.Select((ProjectPropertyInstance property) => new DictionaryEntry(property.Name, property.EvaluatedValue)); } this.BuildEventContext = LoggingService.LogProjectStarted ( nodeLoggingContext.BuildEventContext, submissionId, configurationId, parentBuildEventContext, projectFullPath, string.Join(";", targets), properties, items, evaluationId, projectContextId ); // No need to log a redundant message in the common case if (toolsVersion != "Current") { LoggingService.LogComment(this.BuildEventContext, MessageImportance.Low, "ToolsVersionInEffectForBuild", toolsVersion); } this.IsValid = true; }