In previous versions of Visual Studio, there was a single entry point to an extension (more specifically, an addin), the OnConnect
method. From there it was possible to perform all the Visual Studio operations, such as adding menu items, and setting up a global exception handler, to gracefully handle unhandled exceptions.
In Visual Studio 2010's VsPackage, things work differently - many parts of the application (such as IWpfTextView
) are composed by MEF and loaded without the explicit control of the package, making handling any exceptions coming from those very difficult.
Without explicitly wrapping all such components in a try..catch
of their own, how can I efficiently implement a global handler for (non-critical) exceptions in my VsPackage?
Again, the goal is having something like ReSharper's exception dialog, where it can handle global exceptions without crashing the Visual Studio.