Skip to content
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

Remove deprecated controls #2091

Closed
RussKie opened this issue Oct 16, 2019 · 16 comments
Closed

Remove deprecated controls #2091

RussKie opened this issue Oct 16, 2019 · 16 comments
Assignees
Labels
tenet-compatibility Incompatibility with previous versions or with WinForms for .NET Framework

Comments

@RussKie
Copy link
Member

RussKie commented Oct 16, 2019

Problem description:

The following types have been deprecated in .NET Framework:

However this fact was overlooked during the migration, and the types were brought into .NET Core 3.0.

Expected behavior:

The types are not available to consumers via intellisense.

image

@RussKie RussKie added the tenet-compatibility Incompatibility with previous versions or with WinForms for .NET Framework label Oct 16, 2019
@RussKie RussKie added this to the 3.1 milestone Oct 16, 2019
@RussKie RussKie self-assigned this Oct 16, 2019
@merriemcgaw merriemcgaw changed the title Mark deprecated controls as obsolete Mark deprecated controls as Non Browsable Oct 16, 2019
@merriemcgaw merriemcgaw modified the milestones: 3.1, 5.0 Oct 17, 2019
@RussKie RussKie modified the milestones: 5.0, 3.1 Oct 23, 2019
@ghost ghost added the 🚧 work in progress Work that is current in progress label Oct 23, 2019
RussKie added a commit to RussKie/winforms that referenced this issue Nov 7, 2019
Fixes dotnet#2091

- Remove the following API because they have been obsolete since .NET 2.0:
	* `Menu`
	* `MainMenu`
	* `ContextMenu`
	* `MenuItem`
	* `IMenuEditorService`
	* `ToolBar`
	* `ToolBarAppearance`
	* `ToolBarButton`
	* `ToolBarButtonClickEventArgs`
	* `ToolBarButtonClickEventHandler`
	* `ToolBarButtonStyle`
	* `ToolBarTextAlign`
	* `DataGrid`
	* `DataGridAddNewRow`
	* `DataGridBoolColumn`
	* `DataGridCaption`
	* `DataGridCell`
	* `DataGridColumnCollection`
	* `DataGridColumnStyle`
	* `DataGridDefaultColumnWidthTypeConverter`
	* `DataGridLineStyle`
	* `DataGridParentRows`
	* `DataGridParentRowsLabel`
	* `DataGridRelationshipRow`
	* `DataGridRow`
	* `DataGridState`
	* `DataGridTableCollection`
	* `DataGridTableStyle`
	* `DataGridTextBox`
	* `DataGridTextBoxColumn`
	* `DataGridToolTip`
	* `GridTablesFactory`
	* `IDataGridEditingService`
- Remove the following members in `AxHost` type:
	* `ContextMenu ContextMenu { get; set; }`
	* `event EventHandler ContextMenuChanged`
- Remove the following members in `Control` type:
	* `ContextMenu ContextMenu { get; set; }`
	* `event EventHandler ContextMenuChanged`
	* `void OnContextMenuChanged(EventArgs e)`
- Remove the following members in `Form` type:
	* `MainMenu Menu { get; set; }`
	* `MainMenu MergedMenu { get; }`
	* `void Control.OnContextMenuChanged(EventArgs e)`
- Remove the following members in `NotifyIcon` type:
	* `ContextMenu ContextMenu { get; set; }`
- Remove the following members in `PrintPreviewDialog` type:
	* `MainMenu Menu { get; set; }`
	* `ContextMenu ContextMenu { get; set; }`
	* `event EventHandler ContextMenuChanged`
- Remove the following members in `ToolStripDropDown` type:
	* `ContextMenu ContextMenu { get; set; }`
	* `event EventHandler ContextMenuChanged`
- Remove the following members in `TreeNode` type:
	* `ContextMenu ContextMenu { get; set; }`
- Remove the following members in `UpDownBase` type:
	* `ContextMenu ContextMenu { get; set; }`
@RussKie RussKie changed the title Mark deprecated controls as Non Browsable Remove deprecated controls Nov 7, 2019
@ghost ghost removed the 🚧 work in progress Work that is current in progress label Nov 7, 2019
@RussKie RussKie closed this as completed Nov 11, 2019
@RussKie RussKie removed this from the 3.1 milestone Nov 11, 2019
@hughbe
Copy link
Contributor

hughbe commented Nov 13, 2019

Are we knowingly breaking source compatibility with .NET?

@RussKie
Copy link
Member Author

RussKie commented Nov 18, 2019

Yes. These controls technically have been deprecated since .NET 2.0 (circa 2005) and have been removed from the VS Designer Toolbox.
It was an oversight that we ported these in 3.0.
There will be more official comms coming from Olia and/or Rich.

@chylex
Copy link

chylex commented Dec 4, 2019

Have the controls intended to replace these ever reached the look & feel of native Windows controls? I specifically use MainMenu and ContextMenu in apps targeting .NET Core 3.0 because the -Strip controls have always looked completely out of place. If there's no easy alternative to get native-like controls in 3.1, then the update is a dealbreaker for me.

@RussKie
Copy link
Member Author

RussKie commented Dec 5, 2019

You're welcome to raise a new issue about making controls look Windows native. An associated PR will also be appreciated.

@merriemcgaw
Copy link
Member

@chylex I'm interested to know what the differences are in the newer OSes that make the -Strip controls look completely out of place? What OS are your apps targeting? There may be some improvement possibilities there. File and issue with screen grabs and I'm happy to have the team take a look.

@chylex
Copy link

chylex commented Dec 6, 2019

Alright, is there no way .NET Core can be backwards compatible? While testing this, I installed 3.1.0 by accident, which crashed because of the missing controls, which I suppose is expected, but then it wouldn't even let me install 3.0.0 without uninstalling 3.1.0 first.

If I have to tell people they must uninstall 3.1.0 and install 3.0.0 to use my app, and then reinstall 3.1.0 again if they want to use other new apps, I might as well revert back to .NET Framework for stability.

@chylex
Copy link

chylex commented Dec 6, 2019

Filed #2476 @merriemcgaw, thanks for looking into it.

@RussKie
Copy link
Member Author

RussKie commented Dec 9, 2019

If I have to tell people they must uninstall 3.1.0 and install 3.0.0 to use my app, and then reinstall 3.1.0 again if they want to use other new apps

It is possible to create self-contained apps, so your users will be able to run your apps without needing to install anything other than your app. You can find more info: https://docs.microsoft.com/en-us/dotnet/core/whats-new/dotnet-core-3-0#compiledeploy

@daiplusplus
Copy link

daiplusplus commented Jan 1, 2020

@merriemcgaw The old Menu class wrapped Win32/User32’s native window menubar, whereas MenuStrip (and the other FooStrip controls) were self-windowed WinForms controls that performed their own rendering and layout in managed code and didn’t integrate with the system. They looked great on Windows XP back in 2005 only because the WinForms assembly came with its own manually-defined colour-schemes. Since Vista they’ve looked out-of-place and is why I preferred Menu.

Fundamentally, it’s not because that Menu looks native, it’s because it is native.

Having to use MenuStrip is like having to use Java’s Swing or WPF - users notice that the controls/widgets just don’t feel the same as native (e.g. MFC) applications - and also that by not using native controls / OS GUI features we miss out on OS-provided improvements like textbox spell-checking or animated buttons, and so on.

In your post, you asked how the WinForms team can make MenuStrip look native - but that’s committing yourself to a maintenance treadmill. Why burden yourself with having to tweak MenuStrip every time the UX designers in OSG make changes in future releases of Windows when WinForms users could just automatically inherit those changes by using native widgets?

@LordBenjamin
Copy link

LordBenjamin commented Jan 8, 2020

This breaks the Telerik UI for WinForms library, which is still using ContextMenu at least. I've logged a ticket with them.

Edit: Telerik confirmed that their 2020 library release will be 3.1 compatible and use ContextMenuStrip. This is due mid-January.

Although .NET Core 3.0 is (accidentally!) compatible, it is not an LTS release and will be out of support in the next 3 months. This would also be a concern for a self-contained deployment.

@ayoung-cforp
Copy link

@RussKie

Yes. These controls technically have been deprecated since .NET 2.0 (circa 2005) and have been removed from the VS Designer Toolbox.
It was an oversight that we ported these in 3.0.

I'm not sure what "technically deprecated" means, but the documentation for .NET Framework 4.8's ContextMenu clearly states:

Although ContextMenuStrip replaces and adds functionality to the ContextMenu control of previous versions, ContextMenu is retained for both backward compatibility and future use if you choose.

MainMenu, DataGrid, and the others all say the same thing, and have since .NET 2.0.

I'm personally upset about this change; I've always hated MenuStrip and its ilk and never stopped using the originals. Now I've got 20 years of apps that can't be ported to .NET Core without redesigning all of the menus, toolbars, and context menus.

@LordBenjamin
Copy link

I note that the linked MSDN article also states:

Applies to
.NET Core
3.1 3.0
.NET Framework
4.8 4.7.2 4.7.1 4.7 4.6.2 4.6.1 4.6 4.5.2 4.5.1 4.5 4.0 3.5 3.0 2.0 1.1

Since the information on this page no longer applies to .NET Core 3.1, should a documentation issue be raised? I was confused earlier today, as I found the MSDN article before finding this issue.

@RussKie
Copy link
Member Author

RussKie commented Jan 10, 2020

The docs have been updated.
The suggested replacements for the controls removed in .NET Core 3.1 can be found at https://docs.microsoft.com/dotnet/core/porting/winforms-breaking-changes#recommended-action.

@ayoung-cforp
Copy link

@RussKie I can't understand how this removal benefits your customers at all.

WinForms is already a legacy API to begin with. Wasn't the whole point of porting it to .NET Core so that customers could quickly port legacy apps away from .NET Framework? How exactly does removing the lesser-used components accomplish this?

@RussKie
Copy link
Member Author

RussKie commented Jan 10, 2020

WinForms is already a legacy API to begin with.

What makes you think that?

Wasn't the whole point of porting it to .NET Core so that customers could quickly port legacy apps away from .NET Framework?

No, not quite.
One of the points was to allow our customers to migrate any workloads they may have built on top of Windows Forms stack to .NET Core, if they desired.
However there is no requirement to migrate, .NET Framework isn't going anywhere in the observable future.
It is also incorrect to think that a developer can just replace "net4xx" with "netcoreapp3.1", hit a F5 and expect everything to work.

As far as the removal of outdated controls - there were few reasons, e.g.:

  • these controls were not meeting accessibility requirements, which is a legal requirement for us;
  • there was no VS Designer support.

To put in perspective, if you as a developer not using accessible controls are you providing a good service to your customers?

@ayoung-cforp
Copy link

WinForms is already a legacy API to begin with.

What makes you think that?

Because it's been in "maintenance mode" since at least 2014 (Microsoft's words, not mine) and Microsoft has stated that there are no plans to add new features.

these controls were not meeting accessibility requirements, which is a legal requirement for us;

Are there plans to remove these controls from .NET Framework as well because they do not meet your legal requirements?

if you as a developer not using accessible controls are you providing a good service to your customers?

I don't think using these components prevented us from providing good service to our customers. There is neither a legal requirement nor a moral obligation to use accessible controls when the customer does not require it.

RussKie added a commit that referenced this issue Feb 6, 2020
- Remove the following API because they have been obsolete since .NET 2.0:
	* `StatusBar`
	* `StatusBarDrawItemEventArgs`
	* `StatusBarDrawItemEventHandler`
	* `StatusBarPanel`
	* `StatusBarPanelAutoSize`
	* `StatusBarPanelBorderStyle`
	* `StatusBarPanelClickEventArgs`
	* `StatusBarPanelClickEventHandler`
	* `StatusBarPanelStyle`

Relates to #2091
RussKie added a commit that referenced this issue Feb 7, 2020
- Remove the following API because they have been obsolete since .NET 2.0:
	* `StatusBar`
	* `StatusBarDrawItemEventArgs`
	* `StatusBarDrawItemEventHandler`
	* `StatusBarPanel`
	* `StatusBarPanelAutoSize`
	* `StatusBarPanelBorderStyle`
	* `StatusBarPanelClickEventArgs`
	* `StatusBarPanelClickEventHandler`
	* `StatusBarPanelStyle`

Relates to #2091
RussKie added a commit to RussKie/winforms that referenced this issue Jan 13, 2021
With the deprecation and removal of `MainMenu` control in dotnet#2091 one of MDI
scenarios got broken where both parent and child forms don't have `MainMenuStrip`
property set nor have `MainMenuStrip` instance added to their respective
`Controls` collection.

The fix restores setting an MDI menu via `WM_MDISETMENU` message to the
parent form.

Fixes dotnet#3029
RussKie added a commit to RussKie/winforms that referenced this issue Jan 14, 2021
With the deprecation and removal of `MainMenu` control in dotnet#2091 one of MDI
scenarios got broken where both parent and child forms don't have `MainMenuStrip`
property set nor have `MainMenuStrip` instance added to their respective
`Controls` collection.

The fix restores setting an MDI menu via `WM_MDISETMENU` message to the
parent form.

Fixes dotnet#3029

(cherry picked from commit 8d9b1e6)
@ghost ghost locked as resolved and limited conversation to collaborators Feb 3, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
tenet-compatibility Incompatibility with previous versions or with WinForms for .NET Framework
Projects
None yet
Development

No branches or pull requests

7 participants