Skip to content

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

Open
ricardobossan wants to merge 1 commit into
dotnet:mainfrom
ricardobossan:Issue_14571_Fixes_PropertyGrid.ResetHelpForeColor
Open

Fixes PropertyGrid.ResetHelpForeColor resets the back color instead of the fore color#14572
ricardobossan wants to merge 1 commit into
dotnet:mainfrom
ricardobossan:Issue_14571_Fixes_PropertyGrid.ResetHelpForeColor

Conversation

@ricardobossan
Copy link
Copy Markdown
Member

@ricardobossan ricardobossan commented May 28, 2026

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

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

1 participant