I had a serious scare today with my Help Builder VS.NET Add-in. I’ve been moving around menu options a bit to make the shortcut options a little less intrusive and moved them off into sub-menus. So now the Help Builder menus on the various designer and code window context menus are a single West Wind Html Help Builder item that pops up a secondary drop down. It’s much cleaner looking although it does require some extra menu navigation.

 

Working and debugging Add-Ins with VS.NET is a bit tricky as it is, as you need to use VS.NET to debug VS.NET with VS.NET. In the process you have to make sure that the code instance is not running the Add-in so you can compile the code. I use a routine (actually Help Builder has an option for this) to register and unregister the Add-in.

 

Usually this works fine, but for some strange reason, even though the code instance did not show my add-in as loaded, it somehow was still loaded. You might think this is no big deal – but it manifested in a crash of VS.NET everytime I tried to compile the project.

 

Crashing VS.NET is a scary exercise – surprisingly it’s actually hard to do under normal circumstances. In this case though it crashed on every compile. It took me a while to figure out that it had something to do with the Add-In DLL. When I deleted the DLL I could compile exactly once. However when I reloaded VS.NET the first time, tried recompiling immediately VS.NET would crash again on compile. The file would exist on disk and fail to register as a COM object.

 

Finally, I broke out Process Explorer and looked at what DLLs get loaded into VS.NET and it turns out that indeed VS.NET was loading my add-in even though the Add-In manager said it didn’t have it loaded. Once I quit VS.NET, removed the add-in again, restarted VS.NET and recompiled, everything started working again and the Add-in could be registered to COM and VS.NET once again. Phew.

 

I’ve had issues with this before – it wasn’t the first time that I had started to compile when the same instance of VS.NET was running the Add-In I was trying to compile, but the common behavior you see then is the ‘Can’t create output file’ error. But something in this situation aggravated this behavior and caused VFP to complete crash.

 

Of course, this happened a few hours before I was to demo Help Builder here at OzFox in Australia and I was quite frantic. To make things worse another part of the application (the error handler) broke at the last minute as well. I was able to get things working again a frantic few minutes before the demo. Eeek. The demo went well though and the error handler only fired once <g>…