User control always crashes Visual Studio

visual studio designer error
visual studio debug designer

I'm trying to open a user control in one of our projects. It was created, I believe, in VS 2003, and the project has been converted to VS2008. I can view the code fine, but when I try to load the designer view, VS stops responding and I have to close it with the task manager. I have tried leaving it running for several minutes, but it does not do anything. I ran "devenv /log" but didn't see anything unusual in the log. I can't find a specific error message anywhere. Any idea what the problem might be? Is there a lightweight editing mode I might be able to use or something?

The reason I need to have a look at the visual representation of this control is to decide where to insert some new components.

I've tried googling it and searching SO, but either I don't know what to search or there is nothing out there about this. Any help is appreciated.

(The strangest thing is that the user control seems to load fine in another project which references, but VS crashes as soon as I even so much as click on it in that project.)


The user control is a wrapper of a 3rd party HTML not exactly something which accesses a database.

I just tried putting the control on a new project and it crashed as soon as I dragged it onto the form.

I solved my crashing designer using techniques described here:

Good Way to Debug Visual Studio Designer Errors

I've been able to debug some control designer issues by running a second instance of VS, then from your first VS instance do a "Debug -> Attach to Process" and pick "devenv".


It seems that the Load() method of UserControls somehow gets parsed by the designer. Putting initialisations and other suspicious code in a if - loop - checking for IsDesignMode keeps the designer from reading code that will crash it ....

--update: looking back now, all most things solved when I overthought / refactored the application design.

User control always crashes Visual Studio, Recently I had annoying error after creating user control and attached it to form via designer, visual studio 2010 would always crash whenever design mode of� VS Designer causes VS to crash on WPF project 0 Solution Crash when opening/creating solution 1 Solution Visual Studio crashes when the managed language service's ServiceHub client fails to get a service 0 Solution After VS 2017 Crash, New Project Initialized Error

Your user control may have a property written like this:

private int myPropName; // note the lowercase m
public int MyPropName { get { return MyPropName; } } // the property is returned
                                                     // instead of the variable

Note that the value returned by get is the property itself. This crashes VStudio 2008 when trying to see the properties of the control, which also happens when adding the control (by drag'n drop or else) to a Form.

As pointed out by NickAldwin, this does not generate compiler warning or error.

VS2017 hangs when adding a user control to a form, I registered this user control using the tools in it and I added a new WinForms project to visualize the control. First time I did it it worked ok, but� Most commonly, if Visual Studio is crashing repeatedly, your.suo or.ncb file has become corrupted. Close your project, delete those files, and reopen. This may resolve your problem..suo is a hidden file.

Hangs like these are usually associated with networking. A database perhaps. You have to watch out for code that runs inside the UserControl at design time. Not just the constructor, also the Load event, timers, OnHandleCreated, OnResize, etcetera. The way to avoid running that code is by testing the DesignMode property, don't do anything dangerous when it is true.

Your ultimate fallback is to debug the code at design time with another instance of Visual Studio.

C# Visual studio 2017 crash when custom user control throw , I am learning write my own user controls , and i find that when i throw exception during designer view, Visual studio 2017 will stop working. User Control Designer does not display in VS 2019 visual studio 2019 version 16.0 windows 10.0 solution KKeller reported Apr 03, 2019 at 01:53 PM

To follow up on womb's post, I found the following code to help out and block VS from crashing and reading the onLoad function.

I cannot reply and did not want to add a new comment. You can use the following in the Load method and stop VS from reading it and crashing. This was taken from this article

bool isDesignMode = (System.Diagnostics.Process.GetCurrentProcess().ProcessName.IndexOf("devenv") != -1);
            if (isDesignMode)

Visual Studio 2019 Preview Release Notes, This release is not "go-live" and not intended for use on production computers or Visual Studio 2019 version 16.6 Preview 2 Brings New Features Your Ctrl R, Ctrl A - Debug All Test - Global command always debugs all tests In this release this feature works with all the out-of-the-box controls for WPF� Visual Studio dev tools & services make app development easy for any platform & language. Try our Mac & Windows code editor, IDE, or Azure DevOps for free.

I had the same problem. In my case, the problem was (I think) that I was initializing a member array in the declaration instead of in the constructor. The error was that the the VisualStudio project for my application immediately crashed when I tried to use the custom control from my lib that had the "bad" declaration.

It was frustrating because my custom component lib compiled with no errors.


code that crashed:

class MyCustomObject: UserControl
  private List<int> myList = new <int>List();
   public MyCustomObject(){

// other code here


class MyCustomObject: UserControl
   private List<int> myList;
   public MyCustomObject(){
        myList= = new <int>List();

// other code here

User control always crashes Visual Studio, User control always crashes Visual Studio. Question. I'm trying to open a user control in one of our projects. It was created, I believe, in VS 2003, and the project � visual studio 2017 ide repos Fixed-in: Visual Studio 2017 Version 15.1 windows 6.3 Josh Clark reported Mar 09, 2017 at 03:14 PM Show comments 39

Tutorial :User control always crashes Visual Studio, I'm trying to open a user control in one of our projects. It was created, I believe, in VS 2003, and the project has been converted to VS2008. I can view the code� Tech support scams are an industry-wide issue where scammers trick you into paying for unnecessary technical support services. Additionally, some scammers may try to identify themselves as a Microsoft MVP.

User control always crashes Visual Studio-第2页回答- 码农岛, User control always crashes Visual Studio. Anthone 关注. 发布时间:2019-02-08 16:59. I'm trying to open a user control in one of our projects. It was created, I� When I drop the user control onto a form from the toolbox, the user control is rendered then crashes Visual Studio. I can't event get to the point of compiling or hooking the process. There is no process, it's simply the drag drop operation of the user control to the form. When the control appears on the form, it crashes.

User control always crashes Visual Studio, User control always crashes Visual Studio. Anthone 关注. 发布时间:2019-02-08 16:59. I'm trying to open a user control in one of our projects. It was created, I� In order to complete this walkthrough, you'll need Visual Studio. Create the project. The first step is to create the application project. You will use this project to build the application that hosts the custom control. In Visual Studio, create a new Windows Forms Application project, and name it MarqueeControlTest. Create the control library

  • @Nick: Can you edit your question and tell us more about your user control, what it does? And that does it reference to any external sources, for instance, database, log files, etc.?
  • Lifesaver!!!!! I have been pulling my hair out with this issue!!!! Thanks @wornd :)
  • Second guy recommending this "attach to process"-thing. BUT my app is crashing when adding the userControl. So I cant debug because "attach to process" is also starting the dubbing itself. In this case nothing will happen where I havnt placed the userControl....
  • C4ud3x cannot follow what you mean by "itself" ;) you run a 2nd instance of VS and then attach to process dev.env, then insert you usercontrol in 1st instance of VS -> then both VS die ?
  • Checking for DesignMode inside OnLoad() solved my issue, thanks.
  • But this should also cause compiler errors/warnings, which I am not getting.
  • Bingo. I had this and it actually threw a StackOverflow but obviously only when the getter was called. Fixing this fixed my designer crash. It's a shame I didn't find this before uninstall .. reinstall for a day or 2. DERP.
  • I am embarrassed to admit how long I was debugging the VS crash until I stumbled on this answer. Thank you!
  • Just did the same dumb mistake (and I never do this I always return the member variable and not the property - I don't even understand how/why my brain typed it out like this). After 20 minutes of continual Visual Studio crashes, I double-checked based on your post. You are awesome!
  • Hours wasted looking in to the source of this crash... thanks !
  • +1 for debugging with another instance of VS, that works for me.