Skip to content

Conversation

@SimonZhao888
Copy link
Member

@SimonZhao888 SimonZhao888 commented Nov 24, 2025

Fixes #14071

Proposed changes

  • Refactored the CopyTo methods to ensure correct item copying and type safety.

Customer Impact

  • Copying ComboBox items to an array or using a collection wrapper will not throw an InvalidCastException exception.

Regression?

  • Yes

Risk

  • Minimal

Screenshots

Before

Before.mp4

After

After.mp4

Test methodology

  • Manually

Test environment(s)

  • 10.0.100-rc.2.25502.107
Microsoft Reviewers: Open in CodeFlow

…int index) copies Entry object, not inner item
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes issue #14071 where ComboBox.ObjectCollection.CopyTo(Array destination, int index) was incorrectly copying internal Entry wrapper objects instead of the actual items contained within them. This caused InvalidCastException when using collection wrappers or explicit ICollection interface calls.

Key changes:

  • Modified the explicit ICollection.CopyTo implementation to unwrap Entry objects by accessing .Item property
  • Ensures consistency between the typed CopyTo(object[], int) and explicit ICollection.CopyTo(Array, int) implementations

@codecov
Copy link

codecov bot commented Nov 24, 2025

Codecov Report

❌ Patch coverage is 0% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 77.15185%. Comparing base (09c759b) to head (80df32d).

Additional details and impacted files
@@                 Coverage Diff                 @@
##                main      #14075         +/-   ##
===================================================
- Coverage   77.16719%   77.15185%   -0.01535%     
===================================================
  Files           3279        3279                 
  Lines         645317      645317                 
  Branches       47718       47718                 
===================================================
- Hits          497973      497874         -99     
- Misses        143657      143757        +100     
+ Partials        3687        3686          -1     
Flag Coverage Δ
Debug 77.15185% <0.00000%> (-0.01535%) ⬇️
integration 18.98337% <0.00000%> (-0.03587%) ⬇️
production 52.01170% <0.00000%> (-0.03439%) ⬇️
test 97.40749% <ø> (ø)
unit 49.44068% <0.00000%> (-0.03196%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Member

@ricardobossan ricardobossan left a comment

Choose a reason for hiding this comment

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

All LGTM!

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.

ComboBox.ObjectCollection.CopyTo(Array destination, int index) copies Entry object, not inner item

3 participants