How do I get from IVsSimpleBrowseComponentSet a IVsSimpleObjectList2 RRS feed

  • Question

  • Hi,

    I created a IVsSimpleBrowseComponentSet for the current scope of my language to provide intellisense.

    I created the component set and added the components for the scope, successfully.

    But why GetList2 from the IVsSimpleBrowseComponentSet returns a IVsObjectList2, that is hard to access from managed code. How can I form request to the component set and get a IVsSimpleObjectList2 like on the IVsSimpleObjectLibrary2?

    Saturday, November 29, 2014 11:06 AM

All replies

  • Hi tw_mei,

    Have you tried convert IVsObjectList2 to IVsSimpleObjectList2 explicitly? As the document indicated, IVsSimpleObjectList2 is just a simplified version of IVsObjectList2:


    private string GetListDetails(IVsObjectList2 list)
                IVsSimpleObjectList2 simpleList = list as IVsSimpleObjectList2;

    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    • Edited by Caillen Monday, December 1, 2014 9:44 AM
    Monday, December 1, 2014 9:43 AM
  • Hi,

    yes, I did:

    private IVsSimpleBrowseComponentSet libraryScope = null; ... // get the object manager IVsObjectManager2 mgr = LanguageService.GetService(typeof(SVsObjectManager)) as IVsObjectManager2; ... // create component set ErrorHandler.ThrowOnFailure(mgr.CreateSimpleBrowseComponentSet((uint)_BROWSE_COMPONENT_SET_TYPE.BCST_EXCLUDE_LIBRARIES, null, 0, out libraryScope)); ... // adding components VSCOMPONENTSELECTORDATA[] a = new VSCOMPONENTSELECTORDATA[1]; ErrorHandler.ThrowOnFailure(libraryScope.AddComponent(ref guid, new[] { new VSCOMPONENTSELECTORDATA() { dwSize = dwStructSize, bstrFile = sBasePath + "mscorlib.dll", bstrTitle = "mscorlib", type = VSCOMPONENTTYPE.VSCOMPONENTTYPE_ComPlus } }, out nav, a)); ... // getting all types IVsObjectList2 _list; ErrorHandler.ThrowOnFailure(libraryScope.GetList2((uint)_LIB_LISTTYPE.LLT_CLASSES, (uint)_LIB_FLAGS.LF_GLOBAL, new[] { new VSOBSEARCHCRITERIA2() { eSrchType = VSOBSEARCHTYPE.SO_ENTIREWORD, szName = String.Empty } }, null, out _list));

    IVsSimpleObjectList2 simpleList = _list as IVsSimpleObjectList2; // results to null

    I also tried Marshal.QueryInterface, but it seams not implemented. And the Interop of IVsObjectList2 is not useable in a managed language .

    Do someone know a good example, of consuming the object library. Because I do not want to reimplement the weel for my ComplationSet.


    IVsSimple* is for the managed access and implementations, but the documentation is very unprecise on this part of the Visual Studio.

    • Edited by tw_mei Monday, December 1, 2014 4:50 PM
    Monday, December 1, 2014 4:45 PM