Skip to content

Conversation

Copy link

Copilot AI commented Nov 21, 2025

Pull Request Description

Count mismatch errors now indicate which collection has more elements instead of the generic "Counts do not match" message.

Before:

Counts do not match

After:

Expected count: 2; Actual count: > 2  // when actual has more
Expected count: > 3; Actual count: 3  // when expected has more

Motivation and Context

When debugging failed collection or dictionary comparisons, the original message provided no information about the nature of the mismatch. The enhanced messages immediately indicate:

  • The count of the shorter collection (exact value)
  • That the longer collection exceeds this count (using > operator)

This follows the established pattern of showing expected vs actual values used elsewhere in the library.

Changes:

  • CollectionEqualizationProfile.cs: Calculate current count at mismatch detection point and format message based on which enumerator has remaining elements
  • DictionaryEqualizationProfile.cs: Use Count property to format message based on which dictionary is larger
  • Added unit tests verifying message format for both scenarios (expected > actual, actual > expected)

Checklist

  • I have tested these changes thoroughly.
  • I have added/updated relevant documentation.
  • My code follows the project's coding guidelines.
  • I have performed a self-review of my changes.
  • My changes are backwards compatible.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • aka.ms
    • Triggering command: /usr/bin/curl curl -I -sSL --retry 5 --retry-delay 2 --connect-timeout 15 REDACTED (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>Improve the "count diff" message</issue_title>
<issue_description>Describe your idea
Currently, if we try to equalize two collections and they have a different count, the error message gives absolutely no information - "Counts do not match".

The new format should be:

  • "Expected count: X; Actual count: > X"
  • "Expected count: > Y; Actual count: Y"

</issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI changed the title [WIP] Improve the count diff error message format Improve count mismatch error messages for collections and dictionaries Nov 21, 2025
Copilot AI requested a review from TonyTroeff November 21, 2025 22:32
Copilot finished work on behalf of TonyTroeff November 21, 2025 22:32
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.

Improve the "count diff" message

2 participants