Skip to content

Conversation

LeafShi1
Copy link
Member

@LeafShi1 LeafShi1 commented Mar 11, 2025

Fixes #13047

Proposed changes

  • Add a logical judgment before invoking listBox.Items[e.Index] in ListBox_DrawItem method in ListBoxes.cs of the WinformsControlsTest application to prevent the exception

Customer Impact

  • The click event can be done normally on ListBox

Regression?

  • No

Risk

  • Minimal

Screenshots

Before

Clicking on ListBox Drawmode.OwnerDrawFixed and ListBox Drawmode.OwnerDrawVariable brings up the exception error window in the WinformsControlsTest application

Image

After

Everything work well on ListBox
AfterChange

Test methodology

  • Manually tested the application

Test environment(s)

  • .net10.0.0-preview.3.25155.12
Microsoft Reviewers: Open in CodeFlow

@LeafShi1 LeafShi1 requested a review from a team as a code owner March 11, 2025 06:05
@LeafShi1 LeafShi1 requested a review from Epica3055 March 11, 2025 06:05
Copy link
Member

@Epica3055 Epica3055 left a comment

Choose a reason for hiding this comment

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

looks good

Copy link

codecov bot commented Mar 11, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 61.28152%. Comparing base (6061b98) to head (a890fee).
Report is 8 commits behind head on main.

Additional details and impacted files
@@                 Coverage Diff                 @@
##                main      #13106         +/-   ##
===================================================
- Coverage   61.28468%   61.28152%   -0.00317%     
===================================================
  Files           1541        1541                 
  Lines         158281      158281                 
  Branches       14743       14743                 
===================================================
- Hits           97002       96997          -5     
- Misses         60581       60586          +5     
  Partials         698         698                 
Flag Coverage Δ
Debug 61.28152% <ø> (-0.00317%) ⬇️
integration 10.73877% <ø> (+0.00105%) ⬆️
production 39.14705% <ø> (-0.00519%) ⬇️
test 95.67280% <ø> (ø)
unit 36.56971% <ø> (-0.00521%) ⬇️

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.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@LeafShi1 LeafShi1 requested a review from Tanya-Solyanik March 11, 2025 08:53
Copy link
Contributor

@Tanya-Solyanik Tanya-Solyanik left a comment

Choose a reason for hiding this comment

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

Thank you!

@Tanya-Solyanik Tanya-Solyanik changed the title Add logical judgment before invoking listBox.Items[e.Index] in ListBoxes.cs of the WinformsControlsTests Test if listbox has any items before invoking listBox.Items[e.Index] in ListBoxes.cs of the WinformsControlsTests Mar 11, 2025
@LeafShi1 LeafShi1 merged commit c22390c into main Mar 12, 2025
8 checks passed
@LeafShi1 LeafShi1 deleted the Fix_13047_Add_Logic_WinformControlsTest branch March 12, 2025 00:44
@dotnet-policy-service dotnet-policy-service bot added this to the 10.0 Preview3 milestone Mar 12, 2025
@github-actions github-actions bot locked and limited conversation to collaborators Apr 11, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Clicking on a ListBox with a Drawmode other than Normal in the WinformsControlsTest application brings up the exception error window
3 participants