Reputation:
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.
Upvotes: 18
Views: 7643
Reputation: 5723
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.
Upvotes: 22
Reputation: 18328
There likely something in the constructor of your control that is attempting to access another something that isn't available, or is creating an exception that can't be caught by the IDE (StackOverflow, OutOfMemory, etc)
Upvotes: 2