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

No way to delete orphaned controls using the designer #12827

Open
abri-damien opened this issue Jan 23, 2025 · 1 comment
Open

No way to delete orphaned controls using the designer #12827

abri-damien opened this issue Jan 23, 2025 · 1 comment
Assignees
Labels
area-Analyzers/CodeFixes A Roslyn Analyzer is either needed for the context, needs to be scope extended or fixed. area-VSDesigner Windows Forms out-of-proc designer related issues customer-reported

Comments

@abri-damien
Copy link

abri-damien commented Jan 23, 2025

Environment

Visual Studio Professional 2022
Version 17.12.4

.NET version

.NET 8

Did this work in a previous version of Visual Studio and/or previous .NET release?

Unsure, we've only noticed recently.

Issue description

We have a large Windows Forms project that we've migrated from .NET Framework 3.5 -> .NET Framework 4.8 -> .NET 8 during the last 5 years and we're finding forms that have a lot of orphaned controls. By that I mean controls that aren't attached to anything so you can't select them in the designer aside from the drop-down in the properties window.

We don't know how they got there, but we've not seen them prior to upgrading to .NET 8 which we used the .NET Upgrade Assistant for. They could have been there, but we haven't seen them until recently. They appear to have been generated a second time from existing controls that are in the form and then given the default name e.g. TabPage1 but that's just a guess. You can't actually select these inside the designer and its not possible to delete them without going into the designer generated code-behind file and deleting the code for them manually.

It would be nice if there was a compiler warning for orphaned controls and a way to delete them and their sub-controls from the designer itself so we don't have to risk breaking something.

Steps to reproduce

Unfortunately, I don't know how they got there. They're not easy to identify unless you're looking for a control in the properties window drop-down and happen to stumble upon one that doesn't display a selection box around it or change the view (like switching a tab page for example - if you switch to one thats an orphaned control it doesn't have a tabcontrol attached to switch to).

Diagnostics

No output is written to the Windows Forms Output Window when selecting an orphaned control from the properties window drop-down.
@abri-damien abri-damien added the untriaged The team needs to look at this issue in the next triage label Jan 23, 2025
@elachlan elachlan added the area-Analyzers/CodeFixes A Roslyn Analyzer is either needed for the context, needs to be scope extended or fixed. label Jan 23, 2025
@merriemcgaw merriemcgaw added area-VSDesigner Windows Forms out-of-proc designer related issues customer-reported labels Jan 23, 2025
@merriemcgaw merriemcgaw removed the untriaged The team needs to look at this issue in the next triage label Jan 28, 2025
@merriemcgaw
Copy link
Member

@KlausLoeffelmann to investigate and try to repro.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-Analyzers/CodeFixes A Roslyn Analyzer is either needed for the context, needs to be scope extended or fixed. area-VSDesigner Windows Forms out-of-proc designer related issues customer-reported
Projects
None yet
Development

No branches or pull requests

4 participants