When will MS get VS under control??????????

Lloyd Sheen 1,476 Reputation points
2023-02-25T15:19:27.7633333+00:00

The project is a win forms project.

So I take my project (created before 17.4.5) and add a couple of lines of code. Go to run it and get

"Should have two or more class parts". A search for that come up blank.

So click that and "Unable to start debugging ...........".

Also cannot close VS as I keep getting the "should have" msg.

So now VS is so broken that I cannot make changes, debug, do ANYTHING!!!!!!!!!!!!!!

So then I close the form designer and don't save it. Now it appears that the project no longer knows what a form is.

IS THERE A DEVELOPMENT TOOL THAT DOES MAUI AND ACTUALLY WORKS????????????

IS THERE A DEVELOPMENT TOOL THAT MS HAS ENOUGH PRIDE IN TO MAKE IT WORK??????

Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
4,797 questions
{count} votes

4 answers

Sort by: Most helpful
  1. Patrick Gallagher 10 Reputation points
    2023-03-01T13:29:48.99+00:00

    I had the same problem. I had a second small class defined in the form class file.

    Moving this class into its own file solved the problem.

    2 people found this answer helpful.

  2. Reza Aghaei 4,941 Reputation points MVP
    2023-02-26T16:33:46.3766667+00:00

    I've used the same VS version, without an issue, and now I'm on 17.4.4 and soon I'll update to 17.5. On thing that you may want to make sure is:

    • Make sure you have a correct installation of Windows Development tools (by opening VS installer and making sure the windows desktop development workload is checked)
    • If you are experiencing issues with WinForms .NET project templates, you may want to use .NET Framework. Sometimes you may encounter temporary issues with VS WinForms designer of .NET 6 or 7 as it's totally new and different. But the VS WinForms designer of .NET Framework is the good old one without any change.

    You may also want to take a look at this:

    The guide is up to date and shows the both points that I mentioned above.

    As I mentioned in my last comment, you need to share step-by-step guide, or maybe some screenshot of the issue, otherwise people cannot easily guess what the issue you are encountering and what the possible solutions may exists for that.


  3. Anonymous
    2023-02-27T17:04:36.4366667+00:00

    (Feb 27, 2023) After installing VS 17.5 (I have VS 2022 Pro), I have been experiencing the same thing whereby when double-clicking on a Button1 on Form1, I have been getting either the "should have two classes" popup, or the "Commit line" popup. Although there is unique code and no redundant code for Button1, and the appropriate "Handles Button1.Click" is listed at the suffix of Button1's code, VS is not taking me to that code. MS needs to not ask users questions about duplicating this issue, but rather, ask themselves:

    1. Why are the "should have two classes" and "commit line" popups being triggered when a user double-clicks on a Button1 on Form1?
    2. Why does VS not navigate and show the code listing for Button1 after double-clicking on Button1?

  4. Anna Xiu-MSFT 27,226 Reputation points Microsoft Vendor
    2023-03-01T09:48:12.6366667+00:00

    Hello everyone,

    I tested on the latest version 17.5.1 and can reproduce the error “Should have two or more class parts”.

    I found that other community users have reported the issue.

    Please vote it in that ticket and add your comments to track the process.

    If there are any updates from Product Team, I will update here.

    Thanks for your understanding!

    Sincerely,

    Anna


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment". 
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments