Question

In testing a number of changes to a custom WinForms control I'm encountering some issues which only occur when loading a form hosting the custom control in the Visual Studio designer.

As a result, I'd like to understand if there is any method for debugging and stepping through (or logging in some way) the behaviour of the custom control's code when the Visual Studio designer loads.

Was it helpful?

Solution

When debugging custom controls, you need to launch a second instance of Visual Studio by setting your project's debug properties to "start external program" and set the executable path to devenv.exe.

Then in the second instance of VS, open the project you're working on, and you will be able to debug the code triggered by the designer. In the 1st instance, set breakpoints in your custom control, and they will be hit when the 2nd instance calls up the Form.

Cheers

OTHER TIPS

VS2015: Under "Debug", "Options", "Debugging", "General" uncheck the "Enable just my Code".

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top