Fixes PropertyGrid.ResetHelpForeColor resets the back color instead of the fore color#14572
Open
ricardobossan wants to merge 1 commit into
Open
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #14571
Related #12055
Root Cause
PropertyGrid.ResetHelpForeColor(PropertyGrid.cs:3631) delegated to_helpPane.ResetBackColor()instead of_helpPane.ResetForeColor(); copy-paste typo fromResetHelpBackColor, 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
_helpPane.ResetBackColor()>_helpPane.ResetForeColor().PropertyGrid_ResetHelpForeColor_Invoke_ResetsForeColorOnlyandPropertyGrid_ResetHelpBackColor_Invoke_ResetsBackColorOnly, invoking the private methods directly viaTestAccessor.Dynamicso coverage and regression protection are independent of thePropertyDescriptor.ResetValuepath. 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