If you are creating a .NET custom control that has designer features, you may need
to debug how that control works in the Visual Studio designer. It may seem
weird, but when a control is in the designer, the code is running! The constructor
is called, and events are being triggered. You may have bugs in your code, or need
to understand what code is being hit when certain actions are being performed
in the designer.
The trick to debugging a custom control is fire up a second instance of Visual Studio.
Open the project that has your custom control in it. Then attach the second instance
of Visual Studio to the process running the first instance of Visual Studio. You do this from the
Attach to Process menu item on the Debug menu. In this dialog, the program name of Visual Studio
is "devenv"; select it and click Attach. Then when you use the designer in the first instance of
Visual Studio, it will hit any breakpoints you set in the second instance.
|