-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add hollow types for deprecated UI controls #10913
Add hollow types for deprecated UI controls #10913
Conversation
src/System.Windows.Forms/src/System/Windows/Forms/Controls/Obsolete/ContextMenu/ContextMenu.cs
Outdated
Show resolved
Hide resolved
src/System.Windows.Forms/src/System/Windows/Forms/Controls/Obsolete/ContextMenu/ContextMenu.cs
Outdated
Show resolved
Hide resolved
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #10913 +/- ##
===================================================
- Coverage 76.21334% 76.09947% -0.11388%
===================================================
Files 3197 3227 +30
Lines 640464 641831 +1367
Branches 47220 47252 +32
===================================================
+ Hits 488119 488430 +311
- Misses 148825 149852 +1027
- Partials 3520 3549 +29
Flags with carried forward coverage won't be shown. Click here to find out more. |
src/System.Windows.Forms/src/System/Windows/Forms/Controls/Obsolete/ContextMenu/ContextMenu.cs
Outdated
Show resolved
Hide resolved
src/System.Windows.Forms/src/System/Windows/Forms/Controls/Obsolete/ContextMenu/ContextMenu.cs
Outdated
Show resolved
Hide resolved
src/System.Windows.Forms/src/System/Windows/Forms/Controls/Obsolete/ContextMenu/Menu.cs
Outdated
Show resolved
Hide resolved
src/System.Windows.Forms/src/System/Windows/Forms/Controls/Obsolete/ContextMenu/MenuMerge.cs
Outdated
Show resolved
Hide resolved
src/System.Windows.Forms/src/System/Windows/Forms/Controls/Obsolete/DataGrid/DataGrid.cs
Outdated
Show resolved
Hide resolved
src/System.Windows.Forms/src/System/Windows/Forms/Controls/Obsolete/DataGrid/DataGrid.cs
Outdated
Show resolved
Hide resolved
src/System.Windows.Forms/src/System/Windows/Forms/Controls/Obsolete/DataGrid/DataGrid.cs
Outdated
Show resolved
Hide resolved
...indows.Forms/tests/UnitTests/System/Windows/Forms/AccessibleObjects/AccessibleObjectTests.cs
Show resolved
Hide resolved
...ystem.Windows.Forms/tests/IntegrationTests/WinformsControlsTest/Obsolete/ObsoleteControls.cs
Outdated
Show resolved
Hide resolved
287033f
to
8dc151f
Compare
src/System.Windows.Forms/src/System/Windows/Forms/Controls/Obsolete/DataGrid/DataGrid.cs
Outdated
Show resolved
Hide resolved
src/System.Windows.Forms/src/System/Windows/Forms/Controls/Obsolete/DataGrid/DataGridCell.cs
Outdated
Show resolved
Hide resolved
src/System.Windows.Forms/src/System/Windows/Forms/Controls/Obsolete/DataGrid/DataGridColumn.cs
Outdated
Show resolved
Hide resolved
src/System.Windows.Forms/src/System/Windows/Forms/Controls/Obsolete/ContextMenu/Menu.cs
Outdated
Show resolved
Hide resolved
src/System.Windows.Forms/src/System/Windows/Forms/Controls/Obsolete/DataGrid/DataGrid.cs
Outdated
Show resolved
Hide resolved
src/System.Windows.Forms/src/System/Windows/Forms/Controls/Obsolete/DataGrid/DataGrid.cs
Outdated
Show resolved
Hide resolved
...ystem.Windows.Forms/src/System/Windows/Forms/Controls/Obsolete/DataGrid/DataGridAddNewRow.cs
Outdated
Show resolved
Hide resolved
src/System.Windows.Forms/src/System/Windows/Forms/Controls/Obsolete/DataGrid/DataGridColumn.cs
Outdated
Show resolved
Hide resolved
src/System.Windows.Forms/src/System/Windows/Forms/Controls/Obsolete/DataGrid/DataGridColumn.cs
Outdated
Show resolved
Hide resolved
src/System.Windows.Forms/src/System/Windows/Forms/Controls/Obsolete/StatusBar/StatusBar.cs
Outdated
Show resolved
Hide resolved
...Windows.Forms/src/System/Windows/Forms/Controls/Obsolete/StatusBar/StatusBarDrawItemEvent.cs
Outdated
Show resolved
Hide resolved
src/System.Windows.Forms/src/System/Windows/Forms/Controls/Obsolete/ContextMenu/ContextMenu.cs
Outdated
Show resolved
Hide resolved
...Windows.Forms/src/System/Windows/Forms/Controls/Obsolete/DataGrid/DataGridRelationshipRow.cs
Outdated
Show resolved
Hide resolved
LGTM |
ensure that nullability is disabled on all re-added classes
…oked, thus I changed test to call as many methods as possible directly.
…perties of that type on custom classes (UserControl with a ContextMenu property) are not visible to the PropertyBrowser. There is no reason to define designer Browsable attribute as false on the properties of the re-added types because the types can't be instantiated on the designer surface since these types can't be constructed. The EditorBrowsable attribute is more interesting. If it's defined on the class as Never, that class name is not suggested. However if the user types in the class name, all members will be visible to intellisense. To get rid of all members in the intellisense, we should add attribute set to Never to all properties that come from all base classes (using the new modifier). These properties are not needed for binary compatibility. I don't consider the scenario where the user types in the class name as something we should support at the cost of increased size.
… because these attributes are accessible from the type.
… types to the re-added types because otherwise these property would show in the intellisense where they were not shown in the Framework. Unfortunately, this required re-adding some of the overrides from the base classes.
… override methods or properties are missing on the NET10 types
use single diagnostics ID for add deprecated controls add/remove methods don't have to throw as they are void all void methods, don't have to throw, they can do nothing {}; all returning methods can save space and throw null; instead of a real exception; This is the same thing as the ref assemblies do restore attributes on public members except for private attributes and edditor and property browser attributes that are overriden o the type level.
fc3ebbb
to
130a079
Compare
130a079
to
355118f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot reviewed 52 out of 67 changed files in this pull request and generated no comments.
Files not reviewed (15)
- Winforms.sln: Language not supported
- src/System.Windows.Forms/src/System/Windows/Forms/Controls/Unsupported/DataGrid/DataGridColumnStyle.cs: Evaluated as low risk
- src/System.Windows.Forms.Design/src/System/ComponentModel/Design/Serialization/CodeDomComponentSerializationService.CodeDomSerializationStore.cs: Evaluated as low risk
- src/System.Windows.Forms/src/System/Windows/Forms/Controls/Unsupported/ContextMenu/ContextMenu.cs: Evaluated as low risk
- src/System.Windows.Forms/src/System/Windows/Forms/Controls/Unsupported/DataGrid/DataGridLineStyle.cs: Evaluated as low risk
- src/System.Windows.Forms.Design/src/System/Resources/Tools/StronglyTypedResourceBuilder.cs: Evaluated as low risk
- src/System.Windows.Forms/src/GlobalSuppressions.cs: Evaluated as low risk
- docs/list-of-diagnostics.md: Evaluated as low risk
- src/Common/src/Obsoletions.cs: Evaluated as low risk
- src/System.Windows.Forms/src/System/Windows/Forms/Control.cs: Evaluated as low risk
- src/System.Windows.Forms/src/System/Windows/Forms/Controls/Unsupported/ContextMenu/MenuItem.cs: Evaluated as low risk
- src/System.Windows.Forms/src/System/Windows/Forms/Controls/Unsupported/ContextMenu/Menu.cs: Evaluated as low risk
- src/System.Windows.Forms/src/System/Windows/Forms/Controls/Unsupported/DataGrid/DataGridBoolColumn.cs: Evaluated as low risk
- src/System.Windows.Forms/src/System/Windows/Forms/Controls/Unsupported/DataGrid/DataGridColumnStyle.CompModSwitches.cs: Evaluated as low risk
- src/System.Windows.Forms/src/System/Windows/Forms/Controls/Unsupported/ContextMenu/MenuMerge.cs: Evaluated as low risk
Comments suppressed due to low confidence (1)
src/System.Windows.Forms/src/System/Windows/Forms/Controls/Unsupported/ContextMenu/Menu.MenuItemCollection.cs:58
- [nitpick] Add a comment for the AddRange method to maintain consistency with the rest of the code.
public virtual void AddRange(MenuItem[] items) { }
To the copilot comment -
I'm not adding comments to re-added methods inside the re-added types. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
Fixes #3783
API review
notes - #3783 (comment) and in the video
Proposed changes
Add controls removed in NET3.1 Back to .NET10 for binary compatibility.
throw null
, not thePlatformNotSupportedException
to save space.Test methodology
UnsupportedTypes
that instantiate all re-added types. This project is referenced from the unit test assembly. Unit tests verify that methods from NETFX assembly can be resolved, and types are type-forwarded to the hollow implementation in NET10 instead of throwing the missing member exception.Microsoft.DotNet.GenAPI.Tool
SDK tool against NET10 public surface generated by the same toolMicrosoft Reviewers: Open in CodeFlow