This is my second chance to play with NHProf, first was for demonstration purposes to my friend Murat Haksal. As we are close to release in NH, and being lazy for about a month and a half, I decided to do some work on NH (including serialization of configuration).
As usual, I first looked JIRA for some issues I can solve. I found NH-1391 important, so decided to give it a try. I created the test case and it was failing for lazy and non-lazy collections. This is obviously a bug, however it wasn’t that easy to debug. The reason for being hard is that debugger does many things behind the scenes, and it may even initialize your collections. Therefore, I wasn’t able to locate/trace the problem ( I usually forget where collection queries are built and executed, even if I spent some time before for other bugs). At this time, NH Prof came to the rescue.
By default, it doesn’t show StackTrace that belongs to NHibernate,Castle, etc. However, you can tell it not to do so.
I removed the namespace NHibernate in order to be able to see the stack trace that belongs to NHibernate.
Then the problem was crystal clear. CollectionLoader class is responsible for collections. The rest was easy.
Thanks Ayende! You made it easy!
e2d3183b-83c8-4f14-929b-6861aa4956aa|1|2.0
nhibernate, nhprof