From 794abcbb005017cf3a75850a9f001419bb47bd38 Mon Sep 17 00:00:00 2001 From: Kirill Osenkov Date: Fri, 4 Jun 2021 11:37:30 -0700 Subject: [PATCH] Don't move Properties and Items to ProjectEvaluationFinished if legacy loggers present Switch from the "use the new logic if any logger is present that supports it" to the more conservative "use the old logic if any logger doesn't support the new logic". There are legacy loggers such as the Azure DevOps logger that crash if ProjectStartedEventArgs.Properties is null. Both console loggers also need more work to properly support the new logic. Effectively the new logic will now only take place when the binary logger is the only logger. --- .../BackEnd/Components/Logging/LoggingService.cs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/Build/BackEnd/Components/Logging/LoggingService.cs b/src/Build/BackEnd/Components/Logging/LoggingService.cs index 7f8aa44f50f..eb11739f920 100644 --- a/src/Build/BackEnd/Components/Logging/LoggingService.cs +++ b/src/Build/BackEnd/Components/Logging/LoggingService.cs @@ -514,7 +514,18 @@ public bool IncludeTaskInputs /// public bool IncludeEvaluationPropertiesAndItems { - get => _includeEvaluationPropertiesAndItems ??= _eventSinkDictionary.Values.OfType().Any(sink => sink.IncludeEvaluationPropertiesAndItems); + get + { + if (_includeEvaluationPropertiesAndItems == null) + { + var sinks = _eventSinkDictionary.Values.OfType(); + // .All() on an empty list defaults to true, we want to default to false + _includeEvaluationPropertiesAndItems = sinks.Any() && sinks.All(sink => sink.IncludeEvaluationPropertiesAndItems); + } + + return _includeEvaluationPropertiesAndItems ?? false; + } + set => _includeEvaluationPropertiesAndItems = value; }