Visual Studio 2022 WinForms designer hang on "Loading Designer..."
Asked Answered
S

17

31

When I try to open a WinForms designer in my startup project in a solution, I get a screen "Loading designer...", "You can continue working while the designer is loading in the background". This screen stays forever and the designer is not loading. This seems to happen in any form or control in the project.

If I try to open the designer for another form in another project in the same solution, I get this screen but after a few seconds, the designer is opened.

I tried to clean the project, delete the ".VS" directory, reboot the machine, nothing helped...

Any ideas?

Selfhelp answered 3/12, 2021 at 12:3 Comment(4)
Favor the legacy "Windows Forms App (.NET Framework)" project template on a machine that has this problem. The designer for .NETCore runs out-of-process, making it vulnerable to misbehaving security software.Anywise
Doesn't work for me, either. I guess the machine is too old/slow. Tried different things, nothing works. Switching the logging to verbose shows it hangs on Creating VSCodeDomDesignerLoader. Waited 10 minutes or more, multiple times, nothing. It's possible waiting longer would make it work as the task manager shows the SQL Server activity @HansPassant: it's not necessarily anything related to security then.Periderm
I get this issue but it is intermittent.Beattie
Got this in a fresh project right now. vs 2022, version 17.7.4. The (empty) main form stalls forever.Sailfish
P
21

I had the same problem.

Solved by running VS 2022 as Administrator.

and wait for Nuget Package Update

Purpleness answered 5/1, 2022 at 5:35 Comment(2)
still valid today! and after running as admin one time, the next time you can use as regular user.Druce
Can't believe it: Really did the trick!Theatricals
E
5

I had same problem. I tried Restore Nuget Packages and problem solved.

  1. Select Tools -> Options -> NuGet Package Manager then check Allow Nuget to download missing packages.
  2. Right click on the solution and select Restore Nuget Packages.
  3. Close the solution and reopen it.
Etter answered 20/12, 2021 at 22:19 Comment(4)
when I first tried this it still didn't work. But then I restarted VS and it loaded againEnvelope
"All packages are already installed and there is nothing to restore".Sailfish
I dont have an entry "Restore Nuget Packages".Theatricals
Yay, this worked, didn't even need to restart VS. It did take half a minute for the designer to load.Indubitable
B
2

I had the same issue.

  1. Copy all the files in the project directory.
  2. Create a new project using the template "Windows Forms App (.NET Framework)" not "Windows Forms App".
  3. Then copy all the files from the old project.
Borsch answered 27/1, 2022 at 17:46 Comment(0)
R
2

I have encountered this so many times over the years with Winforms, and now happened to be hitting it again. My guess is that it's purely a resource problem for Visual Studio, combined with lack of error handling when the designer fails to get all memory that it's claiming.

Why: I've tried and failed several times over the past week with a smaller-medium sized solution, but with a complex forms setup (many controls/many nested levels of tabs etc).

I just got it loading again after battling for a couple of days with failures. As I suspected memory/resources this morning I:

  • shut down everything
  • closed all browsers with tons of tabs
  • restarted VS and closed any other bigger apps and restarted VS (VS2022 Community Edition).
  • Left the computer and did some lengthy coffe brewing

.. and surprise when I got back - it loaded for the first time in 5 days.

Next time I'd hit this, what would be really interesting would be switching to another computer - if an opportunity.

@Microsoft staff in case you see this, try stress testing with low resources and see how the Forms Designer behaves.

Edit: I do not run VS as Admin.

Edit Nov/2023: have just recently switched to a clean computer, and still running vs 2022 Community Edition - a lot more robust as overall load on the machine seems to be much lower. Still Designer can fail to load some times, and that without even displaying any error message.

Regicide answered 3/4, 2023 at 6:4 Comment(0)
R
2

In case the designer is waiting for Intellisense (the designer might state "Waiting for intelliSense to finish initializing"), uncheck the ‘Load projects faster’ option in Tools>>Options>>Environment>>Preview Features.

enter image description here

In my case, the Designer loaded immediately after unchecking. Eventually, you need to restart Visual Studio.

This was an answer in https://developercommunity.visualstudio.com/t/winforms-designer-not-loading-message-says-waiting/1161031 in 2020, but it still worked with my Visual Studio 2022.

Rhoads answered 21/7, 2023 at 8:38 Comment(0)
E
1

I was able to fix it by unchecking the option "Track Active Item in Solution Explorer".

Follow these steps to disable this option:

  1. Click the menu Tools > Options
  2. Expand "Projects and Solutions" and click "General"
  3. Uncheck the option "Track Active Item in Solution Explorer"
  4. Click OK
  5. Observe you can now open the Form editor by clicking to Form1.cs by example
Enfleurage answered 5/2, 2023 at 19:45 Comment(0)
G
0

first, you must check NuGet Packet Manager Tools -> NuGet Package Manager -> Package Manager Setting

popup form, click NuGet Package Manager -> General in this tab check "Allow NuGet to download missing packages".

move to down tab "Package Source" if you just have one source is "Microsoft Visual Studio Offline Packages" you just add a package from API NuGet

click oke and taraaaaaa did it work

Gazpacho answered 23/1, 2022 at 16:48 Comment(0)
R
0

Migrated from Studio 2019 on W7 to Studio 2022 on W10. Before opening a 2019 project, I manually change: TargetFramework>net5.0-windows in: TargetFramework>net6.0-windows

Then I rename the net5.0-windows map in the bin\debug in net6.0-windows.

Then I open the project and build it.

After this the forms open.

I tried to use the MS upgrade utility, but that one changed the Forms in Class with the impossibility to open them in the Designer

Ragman answered 9/3, 2023 at 11:16 Comment(0)
M
0

I had the same issue.

The only solution I found:

  • Remove project dependencies
  • Clear the solution

and the designer start working :)

Manning answered 26/3, 2023 at 14:52 Comment(1)
I had this on a brand new project...Sailfish
C
0

I'm currently getting this if my project doesn't have a <Platforms> tag.

If I change the tag to <Platform> (even though I have a single platform x86), it hangs the designer. If I switch back to <Platforms>, it works. (With a project reload in between.) If I have no tag (I am inheriting the property from a props file), it doesn't work.

It pretty consistently works as long as there is a <Platforms> tag. I also need such a tag in a referenced project that has a base form class. (Without one in the base library, the designer would start to load but would get stuck with a grey background.)

Corin answered 24/4, 2023 at 20:46 Comment(1)
This inspired me to try just unloading / reloading the project, and that worked for me. I didn't have a Platform / Platforms tag - this was a branch new project in a branch new solution. Unloading / Reloading the project must do something magical.Alcyone
E
0

For me it helped updating project from .NET 5.0 to .NET 6.0. You first have to check if all dependencies can be used for .NET 6.0

Epi answered 10/8, 2023 at 11:12 Comment(0)
B
0

I'm running VS2022 and I don't think I've ever loaded/viewed my Toolbox since installing this version (ie: Toolbox was not visible in my IDE).

I opened my solution, opened an aspx page in Source view that had a control who's designer I wanted to view (and was causing VS to hang when I tried for weeks now) I clicked Toolbox from the View menu and it had to initialize before displaying. I'm not sure if this step was necessary, but I dragged and dropped the same type of control to my page. All of a sudden I can view the designer window for any type of control on that page. Its a miracle!

Bledsoe answered 23/8, 2023 at 15:43 Comment(0)
C
0

I opened Tools > Options > NuGet Package Manager > Package Sources and the entry in the field "Source" looked suspicious to me:

"https://packagesource"

I changed the vaue into "https://api.nuget.org/v3/index.json" and so far the designer loads much quicker.

Centroclinal answered 6/12, 2023 at 9:41 Comment(0)
T
0

Still have this problem sometimes with new projects. It always works with these steps for me:

  • Close all tabs
  • Double-click project name (opens project file)
  • Change TargetFramework
  • Save
  • Open Form (it will load)
  • Close Form
  • Open project file again
  • Change back to original/desired version

For example

Before:

<TargetFramework>net8.0-windows</TargetFramework>

Temporarily change to:

<TargetFramework>net7.0-windows</TargetFramework>   

Hope this helps someone :-)

Theatricals answered 16/3, 2024 at 16:20 Comment(0)
R
0

This may help a few people. I encountered the same problem which started when I began using Nuget packages. It would work fine in one project and then as soon as I started a new project it would hang.

I end up going to AppData\Local\Microsoft\VisualStudio\17.0_475ac986\ComponentModelCache

and moved the files their into a new folder in case something went wrong. I left ComponentModelCache empty and started VS and it worked fine.

Rehash answered 3/5, 2024 at 0:25 Comment(0)
P
0

What works for me is I click on some .cs open tab and switch back to the .xaml tag. It opens right away then.

Pless answered 13/5, 2024 at 13:57 Comment(0)
S
-2
  1. don't back up your projects with OneDrive
  2. don't give administrator permission to framework or dotnet or visual studio and don't install that way
Stenson answered 28/12, 2021 at 19:15 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.