Comments, how-to's, examples, tools, techniques and other material regarding .NET and related technologies.
Saturday, April 26, 2008
Two More Tips for Debugging Custom Actions
As I mentioned in my previous post one of the options you have to ensure you have sufficient rights to attach to a process, I'd like to share two more suggestions for how you can debug custom actions in your setup project.
At various places you will find the tip to use MessageBox.Show() to stop execution of your custom action. Then when the message box is displayed you can attach the debugger.
When I tried this the list of processes showed me three instances of msiexec.exe and I couldn't identify which one I should connect to. So I decided to select all of them and attach to all of them. Then I set a break point in a line after the message box and hit F5 to continue execution.
Result: Setup continued happily and the break point was ignored. So this didn't help, but here are two simple suggestions that should make your life easier:
Tip 1: For the message box make sure you give it a title or caption. For instance if you use MessageBox.Show() then use the overload that takes two strings as parameters. The first is the message in the message box. The second parameter is the caption. That's the important one since this is the string that you will find in the list of processes when you want to identify the right process.
Tip 2: In the dialog box for attaching the debugger to a process make sure you tick "Show processes from all users" as it might be that the msiexec.exe instance you are interested in is not displayed.
No comments:
Post a Comment
All comments, questions and other feedback is much appreciated. Thank you!