Skip to content

Conversation

@rainersigwald
Copy link
Member

@rainersigwald rainersigwald commented Apr 7, 2023

Summary

Projects that have tasks that run in the .NET Framework 3.5 environment that return metadata are unusable in MSBuild 17.6.0.

The return value of ITaskItem.CloneCustomMetadata is an IDictionary, which is generally (in modern MSBuild) backed by a Dictionary<string, string>, but can be (when given an item from a net35 taskhost) a Hashtable. In the latter situation, casting entries to KeyValuePair<,> fails, because they conform only to DictionaryEntry.

Use that less-well-typed approach--the casts were present in the pre-bulk-edit version of the code. Fixes #8645.

Work item (Internal use): AB#1790945

Customer Impact

Microsoft-internal customer reported breaks in projects that use WiX3.

Regression?

Yes, from #8240.

Testing

Manual validation of the sample project from customer.

Risk

Low (fixes cast to match guaranteed behavior and uses only preexisting casts). But we could also revert #8240 entirely.

The return value of `ITaskItem.CloneCustomMetadata` is an `IDictionary`,
which is generally (in modern MSBuild) backed by a
`Dictionary<string, string>`, but can be (when given an item from a
net35 taskhost) a `Hashtable`. In the latter situation, casting entries
to `KeyValuePair<,>` fails, because they conform only to
`DictionaryEntry`.

Use that less-well-typed approach--the casts were present in the pre-
bulk-edit version of the code. Fixes dotnet#8645.
@rainersigwald rainersigwald added this to the VS 17.6 milestone Apr 7, 2023
@ghost
Copy link

ghost commented Apr 7, 2023

Hello! I noticed that you're targeting one of our servicing branches. Please consider updating the version.

Copy link
Member

@JanKrivanek JanKrivanek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@ghost
Copy link

ghost commented Apr 11, 2023

Hello! I noticed that you're targeting one of our servicing branches. Please consider updating the version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants