I just got Visual Studio 2008 with VSTO. I've created a new Word Addin Project (2007). In playing around, I've noticed that some exceptions don't seem to come back to Visual Studio ... Word seems to Eat them.
So, I tried to even see if the code was being run by putting some alerts at each of the different events I intend to target,
- ThisAddIn_Startup
- ThisAddIn_Shutdown
- Application_DocumentOpen
- Application_NewDocument
- Application_WindowActivate
With just msgbox in each of the subs, it seems to work as expected. But when I add in "Throw New Exception", VSTO doesn't break as expected and the messagebox is not shown (which, I suppose, is to be expected when the sub is in error)
The exception does seem to come back and break on ThisAddIn_Startup and ThisAddIn_Shutdown -- but if any of the other events throw an exception, nothing seems to happen and I'm left scratching my head wondering why code isn't being run.
In the Immediate Window, I see a series of " A first chance exception of type 'System.Exception' occurred in MyAddin.DLL " lines which seem to correspond to exceptions .... How does one debug these things?
Thanks!