Skip to content

Commit 8ebc5ca

Browse files
jehhynesrainersigwald
authored andcommitted
Backward-compatibility with KeyValuePair<string, string> metadata items (#8870)
Backport #8870 to vs17.7.
1 parent 5785ed5 commit 8ebc5ca

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/Build/BackEnd/TaskExecutionHost/TaskExecutionHost.cs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1395,9 +1395,15 @@ private void GatherTaskItemOutputs(bool outputTargetIsItem, string outputTargetN
13951395
// Setting an item spec expects the escaped value, as does setting metadata.
13961396
newItem = new ProjectItemInstance(_projectInstance, outputTargetName, EscapingUtilities.Escape(output.ItemSpec), parameterLocationEscaped);
13971397

1398-
newItem.SetMetadataOnTaskOutput(output.CloneCustomMetadata()
1399-
.Cast<DictionaryEntry>()
1400-
.Select(x => new KeyValuePair<string, string>((string)x.Key, EscapingUtilities.Escape((string)x.Value))));
1398+
newItem.SetMetadataOnTaskOutput(EnumerateMetadata(output.CloneCustomMetadata()));
1399+
1400+
static IEnumerable<KeyValuePair<string, string>> EnumerateMetadata(IDictionary customMetadata)
1401+
{
1402+
foreach (DictionaryEntry de in customMetadata)
1403+
{
1404+
yield return new KeyValuePair<string, string>((string)de.Key, EscapingUtilities.Escape((string)de.Value));
1405+
}
1406+
}
14011407
}
14021408
}
14031409

0 commit comments

Comments
 (0)