I have written a small System.Windows.Forms.UserControl, call it userControl1
, that seems to be working the way I want it to.
From within Visual Studio 2010's Designer, I can drag userControl1
from the toolbar and drop it on a Windows Form that I will call testForm1
. I can wire-up userControl1
, and it works as it should.
However, the purpose of userControl1
is to be able to use it in another UserControl, let's call it userControl2
.
From within Visual Studio 2010's Designer, if I drag userControl1
from the toolbar and drop it onto userControl2
, Visual Studio 2010 will crash with no message other than it is restarting.
At this same time, an Application Error is logged in Event Viewer with Event ID 1000:
Faulting application name: devenv.exe, version: 10.0.40219.1, time stamp: 0x4d5f2a73
Faulting module name: unknown, version: 0.0.0.0, time stamp: 0x00000000
Exception code: 0xc00000fd
Fault offset: 0x0965f816
Faulting process id: 0x1580
Faulting application start time: 0x01cd90f84338e443
Faulting application path: C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\devenv.exe
Faulting module path: unknown
Report Id: 49ddcedf-fcf8-11e1-8016-00248103a942
How can I go about trying to debug this error? Should I look at something in userControl1
or userControl2
?
A few Notes:
1) I can also drag a userControl2
from the toolbar onto testForm1
, and it works (i.e. displays) fine both in the VS2010 Designer and when I run the test app.
2) I have successfully gone into the Designer of userControl2
where I declared and set all of the values for userControl1
, but userControl1
will not display on testForm1
when it is run. If I select userControl1
from within the userControl2
Properties window in the VS2010 Designer, Visual Studio will crash.
3) I am happy to post code, if it helps. Would you prefer the code for userControl1
or userControl2
? Though both controls are small, there is still a lot of code (particularly since this error is likely occurring in the Designer, so I'd have to post that, too.
Please open CMD and go to C:\Program Files (x86)\Microsoft Visual Studio\2019\version name\Common7\IDE folder, run the command: devenv /safemode to run your Visual Studio in safe mode. Then, create a new project and check if the installed extensions lead to the problem or not.
If you experience crashes of Visual Studio, typically when working with a very large solution, your IDE might be out of virtual memory. Typical indicators of the problem include a "one or more errors occurred" message, "the process appears to be deadlocked" message, and OutOfMemory exception in a crash dump.
A UserControl is a collection of controls placed together to be used in a certain way. For example you can place a GroupBox that contains Textbox's, Checkboxes, etc. This is useful when you have to place the same group of controls on/in multiple forms or tabs.
sln in Visual Studio and right-click on the Bar project in Solution Explorer. Select [Add existing item] and select all files that you copied for the Foo form in the dialog opened. After confirming, you should see the newly imported form correctly in Solution Explorer.
It seems this helped to resolve the issue, so I'm posting it as an answer.
In order to debug your control when used in Visual Studio designer, run two instances of Visual studio and open your project in both instances. Then, in one of the instances use Attach to process... option and attach to the second instance to debug it (devenv.exe process). This way, you should be able to see what the exception is.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With