Skip to content

Fixes PropertyGrid.ResetHelpForeColor resets the back color instead of the fore color - #14572

Merged
ricardobossan merged 1 commit into
dotnet:mainfrom
ricardobossan:Issue_14571_Fixes_PropertyGrid.ResetHelpForeColor
Jul 2, 2026
Merged

ricardobossan merged 1 commit into
dotnet:mainfrom
ricardobossan:Issue_14571_Fixes_PropertyGrid.ResetHelpForeColor

Conversation

@ricardobossan

@ricardobossan ricardobossan commented May 28, 2026 •

Copy link
Copy Markdown
Member

Fixes #14571
Related #12055

Root Cause

PropertyGrid.ResetHelpForeColor (PropertyGrid.cs:3631) delegated to _helpPane.ResetBackColor() instead of _helpPane.ResetForeColor(); copy-paste typo from ResetHelpBackColor, present since the initial WinForms source import in 2018. The method is private with zero call sites, so the defect was never observable through any public API and went undetected.

Proposed changes

  • PropertyGrid.cs:3631: _helpPane.ResetBackColor() > _helpPane.ResetForeColor().
  • PropertyGridTests.cs: add PropertyGrid_ResetHelpForeColor_Invoke_ResetsForeColorOnly and PropertyGrid_ResetHelpBackColor_Invoke_ResetsBackColorOnly, invoking the private methods directly via TestAccessor.Dynamic so coverage and regression protection are independent of the PropertyDescriptor.ResetValue path. Contributes to Unit test coverage for the PropertyGrid class #12055.

Customer Impact

None. The buggy method has no call sites; no shipped behavior changes.

Regression?

No.

Risk

Minimal

Test methodology

Unit tests

Test environment(s)

11.0.100-preview.5.26227.104

Microsoft Reviewers: Open in CodeFlow

Related dotnet#12055

`PropertyGrid.ResetHelpForeColor` (PropertyGrid.cs:3631) delegated to `_helpPane.ResetBackColor()` instead of `_helpPane.ResetForeColor()` — copy-paste typo from `ResetHelpBackColor`, present since the initial WinForms source import in 2018. The method is private with zero call sites, so the defect was never observable through any public API and went undetected.

- PropertyGrid.cs:3631: `_helpPane.ResetBackColor()` → `_helpPane.ResetForeColor()`.
- PropertyGridTests.cs: add `PropertyGrid_ResetHelpForeColor_Invoke_ResetsForeColorOnly` and `PropertyGrid_ResetHelpBackColor_Invoke_ResetsBackColorOnly`, invoking the private methods directly via `TestAccessor.Dynamic` so coverage and regression protection are independent of the `PropertyDescriptor.ResetValue` path. Contributes to dotnet#12055.

None. The buggy method has no call sites; no shipped behavior changes.

No.

Minimal

Unit tests. Two new tests in `PropertyGridTests.cs` directly invoke `ResetHelpForeColor` and `ResetHelpBackColor` via `TestAccessor.Dynamic` and assert that only the targeted color is reset while the sibling color is left untouched.

11.0.100-preview.5.26227.104

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@SimonZhao888

Copy link
Copy Markdown
Member

Looks good to me.

@LeafShi1 LeafShi1 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.

Good catch!

@LeafShi1 LeafShi1 added the waiting-review This item is waiting on review by one or more members of team label May 29, 2026
@LeafShi1 LeafShi1 added this to the 11.0-preview7 milestone Jul 1, 2026
@ricardobossan
ricardobossan merged commit 9bb0153 into dotnet:main Jul 2, 2026
10 checks passed
@dotnet-policy-service dotnet-policy-service Bot removed the waiting-review This item is waiting on review by one or more members of team label Jul 2, 2026
@LeafShi1 LeafShi1 added the releasenotes-candidate This issue is a candidate to be mentioned in the release notes, if the respective PR fixed it. label Jul 15, 2026
@github-actions github-actions Bot locked and limited conversation to collaborators Aug 14, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

needs-area-label releasenotes-candidate This issue is a candidate to be mentioned in the release notes, if the respective PR fixed it.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

PropertyGrid.ResetHelpForeColor resets the back color instead of the fore color

5 participants