Skip to content

Fix copy-paste error in SdkResult equality check#13491

Draft
Copilot wants to merge 3 commits intomainfrom
copilot/fix-equality-check-sdkresult
Draft

Fix copy-paste error in SdkResult equality check#13491
Copilot wants to merge 3 commits intomainfrom
copilot/fix-equality-check-sdkresult

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 6, 2026

Context

SdkResult.Equals compared _itemsToAdd?.Count against result._propertiesToAdd?.Count instead of result._itemsToAdd?.Count — a copy-paste error from the line above. This means two SdkResult instances with different item counts could compare as equal when the item count happened to match the other's property count.

Changes Made

  • Fixed the comparison in SdkResult.Equals to compare items count against items count:
// Before (bug)
_itemsToAdd?.Count == result._propertiesToAdd?.Count &&
// After (fix)
_itemsToAdd?.Count == result._itemsToAdd?.Count &&

Testing

  • Added SdkResult_NotEqual_DifferentItemsCount regression test that constructs two SdkResult objects with identical properties but different item counts, verifying they are not equal.

Notes

@dotnet-policy-service
Copy link
Copy Markdown
Contributor

Hello @@copilot, I noticed that you’re changing an .swr file or any file under src/Package/MSBuild.VSSetup.. Please make sure to validate this change by an experimental VS insertion. This is accomplished by pushing to an exp/* branch, which requires write permissions to this repo.

Copilot AI linked an issue Apr 6, 2026 that may be closed by this pull request
Copilot AI and others added 2 commits April 6, 2026 18:30
…roperties count

Agent-Logs-Url: https://github.com/dotnet/msbuild/sessions/dcd4bcc5-60b7-46b1-bd22-37d2cad41a84

Co-authored-by: rainersigwald <3347530+rainersigwald@users.noreply.github.com>
Agent-Logs-Url: https://github.com/dotnet/msbuild/sessions/dcd4bcc5-60b7-46b1-bd22-37d2cad41a84

Co-authored-by: rainersigwald <3347530+rainersigwald@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix incorrect sizing in SdkResult equality check Fix copy-paste error in SdkResult equality check Apr 6, 2026
Copilot AI requested a review from rainersigwald April 6, 2026 18:31
public class SdkResultItemComparison_Tests
{
[Fact]
public void SdkResult_NotEqual_DifferentItemsCount()
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.

Add a comment that this is a regression test for #13490

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.

Incorrect sizing in SdkResult equality check.

2 participants