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.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
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??????
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.
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:
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.
(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:
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.