Place this code somewhere in a Word document level VSTO solution outside of ThisDocument_Startup (create a ribbon button, with a click event):
int zero = 0;
int divideByZero = 10 / zero;
Start without debugging (Ctrl + F5), Result: Exception is swallowed, the rest of the code fails silently.
The exception will be visible if placed in ThisDocument_Startup, but it appears nowhere else. Microsoft's VSTO forums and the MSDN documentation seem to feel Try...Catch should be used - which is not a big deal for known unknowns. What about the unknown unknowns?
All the common ways of dealing with unhandled exceptions for managed code don't seem to work, presumably because of VSTO using managed code with Office COM Interops:
//These don't work
AppDomain.CurrentDomain.UnhandledException ...
System.Windows.Forms.Application.ThreadException ...
I've read posts about troubleshooting VSTO code that always seems to lead to placing Try...Catch around practically everything!
Is there any better way to handle known and unknown (now invisible and silent!) failures?