Skip to content

Commit f866220

Browse files
Merge pull request #743 from JanKrivanek/bugfix/read-properties-fix
Fix the read global properties backcompat issue
2 parents d72b8bf + 861846b commit f866220

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

src/StructuredLogger/BinaryLogger/BuildEventArgsReader.cs

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -724,7 +724,12 @@ private BuildEventArgs ReadProjectEvaluationFinishedEventArgs()
724724
if (_fileFormatVersion >= 12)
725725
{
726726
IEnumerable globalProperties = null;
727-
if (ReadBoolean())
727+
// In newer versions, we store the global properties always, as it handles
728+
// null and empty within WriteProperties already.
729+
// This saves a single boolean, but mainly doesn't hide the difference between null and empty
730+
// during write->read roundtrip.
731+
if (_fileFormatVersion >= BinaryLogger.ForwardCompatibilityMinimalVersion ||
732+
ReadBoolean())
728733
{
729734
globalProperties = ReadStringDictionary();
730735
}
@@ -778,12 +783,12 @@ private BuildEventArgs ReadProjectStartedEventArgs()
778783

779784
if (_fileFormatVersion > 6)
780785
{
781-
if (_fileFormatVersion < BinaryLogger.ForwardCompatibilityMinimalVersion)
786+
// See ReadProjectEvaluationFinishedEventArgs for details on why we always store global properties in newer version.
787+
if (_fileFormatVersion >= BinaryLogger.ForwardCompatibilityMinimalVersion ||
788+
ReadBoolean())
782789
{
783-
// Throw away, but need to advance past it
784-
ReadBoolean();
790+
globalProperties = ReadStringDictionary();
785791
}
786-
globalProperties = ReadStringDictionary();
787792
}
788793

789794
var propertyList = ReadPropertyList();

0 commit comments

Comments
 (0)