Been playing around with site definitions lately and came across the most random error. I had deployed a site definition solution to my test farm and then all of a sudden I couln't access central admin. The error was:
"Exception occurred. (Exception from HRESULT: 0x80020009 (DISP_E_EXCEPTION))".
This didn't mean much to me and google suggested that I rebuild my site collection. In the end I fonud that there was a problem with my WEBTEMP.xml file.
I Had added a site template configuration like this:
<Configuration ID="1" Title="Base Publishing Site (Hidden)" Hidden="True" />
Which looks ok to me and I have seen a few samples that.
The missing element was the ImageUrl. So what I should have is:
<Configuration ID="1" Title="Base Publishing Site (Hidden)" Hidden="True" ImageUrl="/_layouts/images/blankprev.png" />