Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Backward-compatibility with KeyValuePair<string, string> metadata items [#8864] - #8870

#8870
Merged
JanKrivanek merged 3 commits into
dotnet:maindotnet/msbuild:mainfrom
jehhynes:mainjehhynes/msbuild:mainCopy head branch name to clipboard
Jun 29, 2023
Merged

Backward-compatibility with KeyValuePair<string, string> metadata items [#8864]#8870
JanKrivanek merged 3 commits into
dotnet:maindotnet/msbuild:mainfrom
jehhynes:mainjehhynes/msbuild:mainCopy head branch name to clipboard

Conversation

@jehhynes

@jehhynes jehhynes commented Jun 12, 2023

Copy link
Copy Markdown
Contributor

Fixes #8864

Context

TaskExecutionHost.cs

Changes Made

Fallback to the prior behavior of expecting metadata items of type KeyValuePair<string, string>

Testing

This has not been tested

@jehhynes

Copy link
Copy Markdown
Contributor Author

@dotnet-policy-service agree

@rainersigwald rainersigwald left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Now that I understand the problem, I'm not sure this fix is sufficient; there could theoretically be an ITaskItem implementation that returned a totally custom type with non-KVP non-DictionaryEntry backing for its IEnumerable implementation.

Taking this would certainly cover the likely implementations, but I'm starting to think we should go back to the foreach for this fallback code path.

Comment thread src/Build/BackEnd/TaskExecutionHost/TaskExecutionHost.cs Outdated
@rainersigwald

Copy link
Copy Markdown
Member

(oh and also . . . thanks for the PR!)

@rainersigwald rainersigwald added this to the VS 17.7 milestone Jun 12, 2023
@AR-May
AR-May requested a review from donJoseLuis June 13, 2023 13:35

@donJoseLuis donJoseLuis left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

a few minor comments.

Comment thread src/Build/BackEnd/TaskExecutionHost/TaskExecutionHost.cs Outdated
Comment thread src/Build/BackEnd/TaskExecutionHost/TaskExecutionHost.cs Outdated
@jehhynes
jehhynes force-pushed the main branch 2 times, most recently from 7b58e87 to a4e179d Compare June 13, 2023 18:23
@jehhynes

jehhynes commented Jun 13, 2023

Copy link
Copy Markdown
Contributor Author

@donJoseLuis @rainersigwald I have updated the PR based on the suggestions to use foreach, InternalErrorException, and if statements.
I believe I will let you guys take it from here - as far as unit testing and discussiong @donJoseLuis 's other concerns. Thanks!

P.S. Do we care that we are assuming all DictionaryEntry's will be <string, string>?

Comment thread src/Build/BackEnd/TaskExecutionHost/TaskExecutionHost.cs Outdated
@rainersigwald

Copy link
Copy Markdown
Member

P.S. Do we care that we are assuming all DictionaryEntry's will be <string, string>?

No, that's ok--it's the only thing that would ever have worked AFAIK.

@jehhynes

Copy link
Copy Markdown
Contributor Author

Updated to loop DictionaryEntry's in the foreach.

@JanKrivanek JanKrivanek left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thank you for diving into this!

If the call to SetMetadata is intentionall - please explain the reasoning in the description.

Without that - it looks good to go

Comment thread src/Build/BackEnd/TaskExecutionHost/TaskExecutionHost.cs Outdated

@JanKrivanek JanKrivanek left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thank you!

@rainersigwald rainersigwald left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

One more small nit (we can avoid reallocations by specifying the size of the list up front). Thanks for working through this, it's looking great!

@JaynieBai, could you please write a test for this case? We'll need a task that returns a custom ITaskItem implementation that has a custom IDictionary type returned from CloneCustomMetadata().

Comment thread src/Build/BackEnd/TaskExecutionHost/TaskExecutionHost.cs Outdated
Co-authored-by: Rainer Sigwald <raines@microsoft.com>
@JaynieBai

Copy link
Copy Markdown
Member

One more small nit (we can avoid reallocations by specifying the size of the list up front). Thanks for working through this, it's looking great!

@JaynieBai, could you please write a test for this case? We'll need a task that returns a custom ITaskItem implementation that has a custom IDictionary type returned from CloneCustomMetadata().

Yeah, I will do that

@JanKrivanek

Copy link
Copy Markdown
Member

@rainersigwald - all expressed concerns seem to be addressed - do you want to revise?

@JanKrivanek
JanKrivanek merged commit c6277a4 into dotnet:main Jun 29, 2023
@JanKrivanek

Copy link
Copy Markdown
Member

/backport to vs17.7

@github-actions

Copy link
Copy Markdown
Contributor

Started backporting to vs17.7: https://github.com/dotnet/msbuild/actions/runs/5415050762

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: MSB4028 "XmlQuery" task's outputs could not be retrieved from the "Values" parameter. Specified cast is not valid.

5 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.