Winforms designer crashing when loading form with user controls

Jimmy Palanca 0 Reputation points
2023-03-17T18:06:28.79+00:00

I have a Winforms form that has 2 user controls. The controls are dynamic, i.e., they use table layout panels quite a bit to control which set of fields are visible or hidden based on user selections. I can edit the user controls in the designer with no problem. But when I try load the form (into the designer), Visual Studio hangs and eventually crashes out. Sometimes it automatically restarts, sometimes not.

Obviously, I was able to add the user controls to the form at some point, and was able to edit the form in the designer for a while before it started crashing. I can also run the app, and the form opens and works without a hitch.

In an effort to determine what is causing this, I commented out all the controls and code in the user controls and all the code in the form, but that didn't help. I created a new user control with the same controls as the old one, and added it to a new form, and I was able to load that form in the designer for a while, but then that started crashing too.

I'm not using any third-party controls, just the ones that come with .NET Framework 4.8.

I'm using version 17.5.2 of the community edition of Visual Studio 2022. I was using verison 17.5.1 and upgraded this morning to see if it would help with the problem. Unfortunately, it didn't.

I would appreciate any help to figure this out, because I have done pretty much everything I could think of.

Thanks.

Windows Forms
Windows Forms
A set of .NET Framework managed libraries for developing graphical user interfaces.
1,838 questions
Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
4,643 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Jimmy Palanca 0 Reputation points
    2023-03-20T14:40:37.7033333+00:00

    Thank you, Jack. I already tried repairing the VS installation and it didn't help. As a matter of fact, I experienced a new issue where VS would occasionally crash when rebuilding the solution. I read somewhere else that this might be caused by antivirus. Norton usually lets me know when it blocks a build from happening, but I added my build folder to its list of exceptions anyway. So far, no crashes on build, but VS still crashes when I try to load the form in the designer.

    BTW, I found following info in event viewer on the crash:

    Faulting module name: clr.dll, version: 4.8.9139.0, time stamp: 0x639963b4

    Exception code: 0xc00000fd