Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bring back ProjectStarted.GlobalProperties #6342

Merged
merged 1 commit into from
Apr 13, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions src/Build/BackEnd/Components/Logging/LoggingService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1170,10 +1170,11 @@ internal void InjectNonSerializedData(LogMessagePacket loggingPacket)
{
ErrorUtilities.VerifyThrow(_configCache.Value.HasConfiguration(projectStartedEventArgs.ProjectId), "Cannot find the project configuration while injecting non-serialized data from out-of-proc node.");
BuildRequestConfiguration buildRequestConfiguration = _configCache.Value[projectStartedEventArgs.ProjectId];
if (!IncludeEvaluationPropertiesAndItems)
{
s_projectStartedEventArgsGlobalProperties.Value.SetValue(projectStartedEventArgs, buildRequestConfiguration.GlobalProperties.ToDictionary(), null);
}

// Always log GlobalProperties on ProjectStarted for compatibility.
// There are loggers that depend on it being not-null and always set.
// See https://github.com/dotnet/msbuild/issues/6341 for details.
s_projectStartedEventArgsGlobalProperties.Value.SetValue(projectStartedEventArgs, buildRequestConfiguration.GlobalProperties.ToDictionary(), index: null);

s_projectStartedEventArgsToolsVersion.Value.SetValue(projectStartedEventArgs, buildRequestConfiguration.ToolsVersion, null);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -595,11 +595,9 @@ public BuildEventContext LogProjectStarted(BuildEventContext nodeBuildEventConte
ErrorUtilities.VerifyThrow(_configCache.Value.HasConfiguration(projectInstanceId), "Cannot find the project configuration while injecting non-serialized data from out-of-proc node.");
var buildRequestConfiguration = _configCache.Value[projectInstanceId];

IDictionary<string, string> globalProperties = null;
if (!IncludeEvaluationPropertiesAndItems)
{
globalProperties = buildRequestConfiguration.GlobalProperties.ToDictionary();
}
// Always log GlobalProperties on ProjectStarted
// See https://github.com/dotnet/msbuild/issues/6341 for details
IDictionary<string, string> globalProperties = buildRequestConfiguration.GlobalProperties.ToDictionary();

var buildEvent = new ProjectStartedEventArgs
(
Expand Down
6 changes: 1 addition & 5 deletions src/Build/Evaluation/Evaluator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -785,11 +785,7 @@ private void Evaluate()

if (this._evaluationLoggingContext.LoggingService.IncludeEvaluationPropertiesAndItems)
{
if (_data.GlobalPropertiesDictionary.Count > 0)
{
globalProperties = _data.GlobalPropertiesDictionary;
}

globalProperties = _data.GlobalPropertiesDictionary;
properties = _data.Properties;
items = _data.Items;
}
Expand Down