Hello anyone,
I run in a confusing problem.
Within my Editor's pane of my custom VisualStudio Package I am getting following error message:
Unable to cast COM object of type 'System.__ComObject' to interface type 'Microsoft.VisualStudio.Shell.Interop.ITrackSelection'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{6D5140C5-7436-11CE-8034-00AA006009FA}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).
The locals are:
+ (ISelectionContainer)selContainer {Microsoft.VisualStudio.Shell.SelectionContainer} Microsoft.VisualStudio.Shell.Interop.ISelectionContainer {Microsoft.VisualStudio.Shell.SelectionContainer}
+selContainer {Microsoft.VisualStudio.Shell.SelectionContainer} Microsoft.VisualStudio.Shell.SelectionContainer
-track COM Object Microsoft.VisualStudio.Shell.Interop.ITrackSelection {System.__ComObject}
The caller code follows, actualy this code part can be found on the web several times, I just copied and pasted it:
private ITrackSelection TrackSelection {
get {
if (trackSel == null)
trackSel = GetService(typeof(STrackSelection)) as ITrackSelection;
return trackSel;
}
}
public void UpdateSelection()
{
ITrackSelection track = TrackSelection;
if (track != null)
track.OnSelectChange((ISelectionContainer)selContainer);
}
The most confusing point is, that within my constructor everything works fine! The interface can be queried and has been excuted, but any following call fails.