I have a VS package with no tool windows, and now I want to add a first tool window to it. This is what I've done:
Added 2 attributes to the main package class:
[ProvideToolWindow(typeof(MainToolWindow))]
and
([ProvideToolWindowVisibility(typeof(MainToolWindow), VSConstants.UICONTEXT.SolutionExists_string)]
Called ToolWindowPane MyWindow = this.FindToolWindow(typeof(MainToolWindow), 0, true);
This results in an exception:
Catastrophic failure (Exception from HRESULT: 0x8000FFFF (E_UNEXPECTED))
What did I miss?
The exception was caused by content being null. Adding this to the window constructor does the trick:
Content = new System.Windows.Controls.UserControl();