My question is not how to debug during design time. I actually want to debug through the events available in designer. I know that the form has load and other type of events. Is there any events in windows forms designer like init, load, etc ?
I have done a similar debugging in ASP through user controls. It allows us to view the output HTML of a user control before adding it to the designer.
I know windows forms and ASP are different but there should be some event to check values of Controls before actually rendering it.
My Form takes a long time to open in the VS designer. So I attached a debugger to VisualStudio (devenv.exe), set a breakpoint in my Form’s InitializeComponent to step through it to see what the problem is. However, the breakpoint is not getting hit.
To debug project code running in the designerOpen a new instance of Visual Studio, and then open a second instance of your project. Set a breakpoint in your project code. In the new instance of Visual Studio, on the menu bar, choose Debug > Attach to Process.
To start debugging, select F5, or choose the Debug Target button in the Standard toolbar, or choose the Start Debugging button in the Debug toolbar, or choose Debug > Start Debugging from the menu bar. The app starts and the debugger runs to the line of code where you set the breakpoint.
To debug design-time of your windows forms project:
devenv.exe
which is located in a path like "C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\devenv.exe"
When may I find this approach useful?
Designer
or a TypeConverter
or a UiTypeEditor
at design time.For more information:
To debug in designer you need to put a breakpoint on top of designer code.
Then start your application and it will stop at the breakpoint.
Press F11 to move one line at the time.
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