/// Wednesday, November 2

When is a PDB not a PDB?

I have been trying all week to debug the CodeInjection library using the .NET SDK's CLR debugger clrdebug.exe. I was able to step through several examples but not the library itself. I checked for the .PDB file and it was there! WTF is going on? I searched the web for a PDB dumper/lister/viewer, nothing. I had no choice but to break out a hex editor. Voila. I don't know what the heck I was looking at but I noticed the executables I could debug had the source filenames embedded into them, my library did not.

I was building them differently. It turns out booc, the command line version, has Parameters.Debug set to true by default, and booc, the NANT task has it false by default even though it generates a .PDB file. Make sure to set debug to true if you want to use clrdbg.

    <booc output="${build.dir}/MGutz.CodeInjection.dll" target="library" debug="${debug}">
        ...
    </booc>

Here's another tip. If you want the debugger to come up automatically, put this in your code.

    // Windows will prompt to start the debugger (if you have SDK installed)
    System.Diagnostics.Debugger.Break() 

Comments:

The default for the debug option of the booc nant task is now true.

Thanks for noticing the inconsistency!
 
Post a Comment



<< Home

This page is powered by Blogger. Isn't yours?