Skip to content

Commit

Permalink
Fix the read global properties backcompat issue
Browse files Browse the repository at this point in the history
  • Loading branch information
JanKrivanek committed Jan 10, 2024
1 parent d72b8bf commit 861846b
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/StructuredLogger/BinaryLogger/BuildEventArgsReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -724,7 +724,12 @@ private BuildEventArgs ReadProjectEvaluationFinishedEventArgs()
if (_fileFormatVersion >= 12)
{
IEnumerable globalProperties = null;
if (ReadBoolean())
// In newer versions, we store the global properties always, as it handles
// null and empty within WriteProperties already.
// This saves a single boolean, but mainly doesn't hide the difference between null and empty
// during write->read roundtrip.
if (_fileFormatVersion >= BinaryLogger.ForwardCompatibilityMinimalVersion ||
ReadBoolean())
{
globalProperties = ReadStringDictionary();
}
Expand Down Expand Up @@ -778,12 +783,12 @@ private BuildEventArgs ReadProjectStartedEventArgs()

if (_fileFormatVersion > 6)
{
if (_fileFormatVersion < BinaryLogger.ForwardCompatibilityMinimalVersion)
// See ReadProjectEvaluationFinishedEventArgs for details on why we always store global properties in newer version.
if (_fileFormatVersion >= BinaryLogger.ForwardCompatibilityMinimalVersion ||
ReadBoolean())
{
// Throw away, but need to advance past it
ReadBoolean();
globalProperties = ReadStringDictionary();
}
globalProperties = ReadStringDictionary();
}

var propertyList = ReadPropertyList();
Expand Down

0 comments on commit 861846b

Please sign in to comment.