Debugging a Wizard

From RAD Studio
Jump to: navigation, search

Go Up to Obtaining Tools API Services

The Tools API provides you with a lot of flexibility in how your wizard interacts with the IDE. With the flexibility comes responsibility, however. It is easy to wind up with dangling pointers or other access violations.

When writing wizards that use the native tools API, you can write code that causes the IDE to crash. It is also possible that you write a wizard that installs but does not act the way you want it to. One of the challenges of working with design-time code is debugging. It's an easy problem to solve, however. Because the wizard is installed in Delphi itself, you simply need to set the package's Host Application to the Delphi executable from the Run > Parameters... menu item.

When you want (or need) to debug the package, don't install it. Instead, choose Run > Run from the menu bar. This starts up a new instance of Delphi. In the new instance, install the already-compiled package by choosing Component > Install Packages... from the menu bar. Back in the original instance of Delphi, you should now see the telltale blue dots that tell you where you can set breakpoints in the wizard source code. (If not, double-check your compiler options to be sure you enabled debugging; make sure you loaded the right package; and double-check the process modules to make extra sure that you loaded the .bpl file you wanted to load.)

You cannot debug into the VCL or RTL code this way, but you have full debug capabilities for the wizard itself, which might be enough to tell what is going wrong.

See Also