Monday, October 03, 2011

Debugging NHibernate: prepare symbol files

To be able to debug the NHibernate source code the debugger must know how to find it. If you are using the 3.0.0 version of NHibernate you may use configuring Visual Studio to use their symbol store. If your NHibernate version is different you need to either compile NHibernate on your own and reference the produced binaries in your application build process or make use of the sourcepack script. Here I will describe the second approach (especially because I’m the author of the sourcepack and I need to advertise it somehow ;) ).

To use sourcepack you will need to install Debugging Tools for Windows (you may install them from the WDK image) and powershell v2. Next step is to download NHibernate binaries (you should have them already in your application bin folder) and NHibernate sources from their sourceforge page.

Now, we are ready to index the NHibernate symbol (pdb) files with the zipped sources. Open powershell console and type:

.\sourcepack.ps1 -sourcesRoot "d:\CSharp\NH\NH\nhibernate\" -sources C:\src\ -symbols C:\temp\sample-app\bin -archiverCommandPath C:\bin\7za\7za.exe -verbose


    d:\CSharp\NH\NH\nhibernate is a path to the source root on a computer where the NHibernate was built (you may check this path using srctool.exe or dbh.exe from the Debugging Tools for Windows – please have a look at my blog for usage examples)
    C:\src\ is a place where you put the downloaded source codes
    C:\temp\sample-app\bin is a place where you have your application binaries (dlls + pdbs)
    C:\bin\7za\7za.exe sourcepack requires a path to the 7za command that will be used by the debugger to extract the necessary source files (sourcepack release already contains the 7za.exe application so just copy it someplace)

Read more: Low Level Design

Posted via email from Jasper-Net