Debugging during “Design Mode”

April 27th, 2006

Debugging during “Design Mode”

Recently I discovered that you can actually debug the visual studio’s designer. The need for something like usually started when you drag & drop and control on your window and you get some weird message in the taskbar or some scary messagebox. To try to figure out what causing this problem you can try the following:

1. In visual studio, select the project you want to debug.
2. Right click -> Properties.
3. Select the debugging tab.
4. Change the debug mode to Program.
5. Set the “Start Application” to be your visual studio IDE (C:\Program Files\Microsoft Visual Studio .NET 2003\Common7\IDE\devenv.exe)
6. Set your solution file in the “command line argument field”.
7. Apply -> OK
8. Select the project you want to debug as the startup project.
9. Run.
10. Set a break point in the place you want to start debug (for example, your control constructor)
11. Drag & Drop the control to one of your windows -> the debugger stop in your breakpoint (its like we debug the visual studio drag & drop operation using visual studio itself)

Hope it helps.

2 Responses to “Debugging during “Design Mode””

  1. Daniel Chait Says:

    Another variation on this idea with a different workflow is to start a second instance of Visual Studio, then choose Debug | Attach to Process. From there, proceed the same as you said.

  2. Lab49 Blog » Blog Archive » DesignMode Flag - Another approach Says:

    [...] « Debugging during “Design Mode” [...]