Fix issue 14049:The title of the collection editor for custom controls in .NET Core is incorrect.#14375
Fix issue 14049:The title of the collection editor for custom controls in .NET Core is incorrect.#14375SimonZhao888 wants to merge 1 commit intodotnet:mainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
Fixes the WinForms designer CollectionEditor dialog caption so that, when the collection item type is a generic ControlProxy<T>-style wrapper around a Control, the caption displays the underlying control type name instead of ControlProxy\1`.
Changes:
- Update
CollectionEditorCollectionFormcaption generation to unwrapControlProxy<T>whenT : Control. - Add a unit test to validate the caption includes the underlying control type name and excludes
ControlProxy\1`.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/System.Windows.Forms.Design/src/System/ComponentModel/Design/CollectionEditor.CollectionEditorCollectionForm.cs | Uses a helper to derive a more user-friendly caption type name by unwrapping ControlProxy<T> for control types. |
| src/System.Windows.Forms.Design/tests/UnitTests/System/ComponentModel/Design/CollectionEditorTests.cs | Adds coverage to ensure the collection editor form caption unwraps ControlProxy<TControl> and shows the underlying control type. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| public void CollectionEditor_CreateCollectionForm_Invoke_Success() | ||
| { | ||
| SubCollectionEditor editor = new(typeof(List<int>)); | ||
| Form form = editor.CreateCollectionForm(); | ||
| Assert.NotSame(form, editor.CreateCollectionForm()); | ||
| } |
There was a problem hiding this comment.
CollectionEditor_CreateCollectionForm_Invoke_Success creates two Form instances without disposing them (the first assigned to form, and the second created inside Assert.NotSame). This can leak window handles/resources across the test run and may cause flaky failures. Please dispose both forms (e.g., wrap each in using or store the second form in a variable and dispose it as well).
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #14375 +/- ##
===================================================
+ Coverage 77.25545% 77.31693% +0.06148%
===================================================
Files 3280 3265 -15
Lines 645315 644463 -852
Branches 47780 47632 -148
===================================================
- Hits 498541 498279 -262
+ Misses 143088 142497 -591
- Partials 3686 3687 +1
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
Fixes #14049
Proposed changes
Customer Impact
Regression?
Risk
Screenshots
Before
After
Test methodology
Test environment(s)
Microsoft Reviewers: Open in CodeFlow