Using VSTS Beta 2 - Strange error COM+ in Add-in

Hi everyone,

I'm using the Extensibility Addin Project type to create a new add-in project. I have added a simple User Control (just a button).
I've used the new EnvDTE80 (DTE2) objects to create a new Tool Window with my button. The relevant code is below:

            windowToolWindow = (((EnvDTE80.Windows2)(applicationObject.Windows)).CreateToolWindow2(addInInstance, "C:\\Documents and Settings\\palleb.EU\\My Documents\\Visual Studio\\Projects\\AddinTOOLB\\AddinTOOLB\\bin\\AddinTOOLB.dll", "AddinTOOLB.Control", "C# Tool window", guidstr, ref objTemp));
            windowToolWindow.Visible = true;

The first call is successful in creating a new window but I get the following error when I examine the window object and obviously the second line of code gives me an exception.

Any ideas Thanks!
****************************************************************
-        windowToolWindow    {System.__ComObject}    EnvDTE.Window {System.__ComObject}
+        [System.__ComObject]    {System.__ComObject}    System.__ComObject
        AutoHides    false    bool
        Caption    "C# Tool window"    string
+        Collection    {System.__ComObject}    EnvDTE.Windows {System.__ComObject}
+        ContextAttributes    'windowToolWindow.ContextAttributes' threw an exception of type 'System.Runtime.InteropServices.COMException'    EnvDTE.ContextAttributes {System.Runtime.InteropServices.COMException}
        Document    null    EnvDTE.Document
+        DTE    {System.__ComObject}    EnvDTE.DTE {System.__ComObject}
        Height    100    int
        HWnd    0    int
        IsFloating    false    bool
        Kind    "Tool"    string
        Left    86    int
        Linkable    true    bool
        LinkedWindowFrame    null    EnvDTE.Window
        LinkedWindows    null    EnvDTE.LinkedWindows
+        Object    {ControlAxSourcingSite [AddinTOOLB.Control]}    object {AddinTOOLB.Control}
        ObjectKind    "{858C3FCD-8B39-4540-A592-F31C1520B174}"    string
        Project    null    EnvDTE.Project
        ProjectItem    null    EnvDTE.ProjectItem
        Selection    null    object
        Top    112    int
        Type    vsWindowTypeToolWindow    EnvDTE.vsWindowType
        Visible    false    bool
        Width    200    int
+        WindowState    'windowToolWindow.WindowState' threw an exception of type 'System.Runtime.InteropServices.COMException'    EnvDTE.vsWindowState {System.Runtime.InteropServices.COMException}
****************************************************************

-        WindowState    'windowToolWindow.WindowState' threw an exception of type 'System.Runtime.InteropServices.COMException'    EnvDTE.vsWindowState {System.Runtime.InteropServices.COMException}
-        base    {"Error HRESULT E_FAIL has been returned from a call to a COM component."}    System.Runtime.InteropServices.ExternalException {System.Runtime.InteropServices.COMException}
+        base    {"Error HRESULT E_FAIL has been returned from a call to a COM component."}    System.SystemException {System.Runtime.InteropServices.COMException}
        ErrorCode    -2147467259    int

************************************************************************
-        ContextAttributes    'windowToolWindow.ContextAttributes' threw an exception of type 'System.Runtime.InteropServices.COMException'    EnvDTE.ContextAttributes {System.Runtime.InteropServices.COMException}
-        base    {"Exception from HRESULT: 0x80043F02"}    System.Runtime.InteropServices.ExternalException {System.Runtime.InteropServices.COMException}
-        base    {"Exception from HRESULT: 0x80043F02"}    System.SystemException {System.Runtime.InteropServices.COMException}
-        base    {"Exception from HRESULT: 0x80043F02"}    System.Exception {System.Runtime.InteropServices.COMException}
+        Data    {System.Collections.ListDictionaryInternal}    System.Collections.IDictionary {System.Collections.ListDictionaryInternal}
        HelpLink    null    string
+        InnerException    null    System.Exception
        Message    "Exception from HRESULT: 0x80043F02"    string
        Source    "EnvDTE"    string
        StackTrace    "   at EnvDTE.Window.get_ContextAttributes()"    string
+        TargetSite    {EnvDTE.ContextAttributes get_ContextAttributes()}    System.Reflection.MethodBase {System.Reflection.RuntimeMethodInfo}
-        Static members       
-        Non-Public members       
        _COMPlusExceptionCode    -532459699    int
-        Non-Public members       
+        [System.Runtime.InteropServices.COMException]    {"Exception from HRESULT: 0x80043F02"}    System.Runtime.InteropServices.COMException
        _className    null    string
+        _data    {System.Collections.ListDictionaryInternal}    System.Collections.IDictionary {System.Collections.ListDictionaryInternal}
        _dynamicMethods    null    object
+        _exceptionMethod    {EnvDTE.ContextAttributes get_ContextAttributes()}    System.Reflection.MethodBase {System.Reflection.RuntimeMethodInfo}
        _exceptionMethodString    null    string
        _helpURL    null    string
        _HResult    -2147205374    int
        _innerException    null    System.Exception
        _message    "Exception from HRESULT: 0x80043F02"    string
        _remoteStackIndex    0    int
        _remoteStackTraceString    null    string
        _source    "EnvDTE"    string
+        _stackTrace    {Dimensions:[16]}    object {sbyte[]}
        _stackTraceString    null    string
        _xcode    -532459699    int
        _xptrs    0    System.IntPtr
        HResult    -2147205374    int
        IsTransient    false    bool
        ErrorCode    -2147205374    int
***********************************************************************



Answer this question

Using VSTS Beta 2 - Strange error COM+ in Add-in

  • Eugene Osovetsky

    Hey all, I have been working on my Add-In for a while in VS2003 and moved it over to 2005 and now I want to be able to have my window integrated into Visual Studio.  Is there a good reference to doing this   I have looked at the DTE2.MainWindow interface and also the DTE2.MainWindow.LinkedWindows.  Do I simply need to implement Window2 interface and then add it to the LinkedWindows collection and that is it   I did find some information but I would like a good example of how to do this so I am not hunting forever.  Or do I have to use the CreateToolWindow instead and if I do how do I use my existing Form I have created as part of it

    Thanks,

    Kenneth Lewis

  • paulballard

    Its possible you may get an answer quicker on the VSTS specific forums, like
    http://forums.microsoft.com/msdn/ShowForum.aspx ForumID=20
    and
    http://forums.microsoft.com/msdn/ShowForum.aspx ForumID=22

  • Using VSTS Beta 2 - Strange error COM+ in Add-in