none
Tool window exception using Windows2.CreateToolWindow2 method

    Question

  • I created a tool window using the following instructions: http://msdn.microsoft.com/en-us/library/dwtd01y4(v=vs.110)

    I set the "register for com interop" in the property window of the project also added the following attributes to the class being referenced on the "class" argument of the Windows2.CreateToolWindow2 Method.

        [ClassInterface(ClassInterfaceType.AutoDual)]
        [ComVisible(true)]
        [GuidAttribute("9ED54F84-A89D-4fcd-A854-44251E925F09")]

    I keep getting the following exception:

    NonComVisibleBaseClass was detected
    Message: A QueryInterface call was made requesting the default IDispatch interface of COM visible managed class 'MyExtention.ShellView'. However since this class does not have an explicit default interface and derives from non COM visible class 'System.Windows.Controls.UserControl', the QueryInterface call will fail. This is done to prevent the non COM visible base class from being constrained by the COM versioning rules.

    Is there something else I have to do to the class to have the window show properly?

    Tuesday, June 19, 2012 1:56 AM

Answers

All replies

  •  i created a wpf usercontrol library and set the register for com interop in the property window of the project. i also added the following attributes on the user control class:

        [ClassInterface(ClassInterfaceType.AutoDual)]
        [ComVisible(true)]
        [GuidAttribute("9ED54F84-A89D-4fcd-A854-44251E925F09")]

     i keep getting the following exception:

    NonComVisibleBaseClass was detected
    Message: A QueryInterface call was made requesting the default IDispatch interface of COM visible managed class 'MyExtention.ShellView'. However since this class does not have an explicit default interface and derives from non COM visible class 'System.Windows.Controls.UserControl', the QueryInterface call will fail. This is done to prevent the non COM visible base class from being constrained by the COM versioning rules.


    Monday, June 18, 2012 3:14 AM
  • Hi sarbaje,

    Thank you for your post.
     
    Based on this case relate to WPF, i am trying to involve someone familiar with this topic to further look at this issue. There might be some time delay. Appreciate your patience.
     
    Thank you for your understanding and support.

    Best regards,

    Ego

     

    Monday, June 18, 2012 9:30 AM
  • Well it's not really related to wpf and the wpf controls library works fine. What I am having trouble with is displaying the tool with out getting the above exception. I followed the instructions here: http://msdn.microsoft.com/en-us/library/dwtd01y4(v=vs.110)

    I have the wpf control library set to "register for com interop" in the project properties window and I have all the attributes set for the actual user control I am trying to load. Now I am using caliburn.micro on my user control library. Would that be a problem? Or as long as I set the right com attributes both on the user control class and the project I should be fine?

    Monday, June 18, 2012 4:42 PM
  • Ego Jiang, please move me back. I could of gotten an answer already if it wasn't for you switching me to the wpf forum. What part of "com exception in toolwindow" in the Visual Studio Extensibility forum makes you think this is a wpf issue? Please make sure you read carefully before moving someone or atleast try to understand their problem.


    Monday, June 18, 2012 4:59 PM
  • I would imagine that the words " i created a wpf usercontrol library" might have lead him to believe that.  I certainly did!

    LS


    Lloyd Sheen

    Monday, June 18, 2012 8:17 PM
  • I would imagine that the words " i created a wpf usercontrol library" might have lead him to believe that.  I certainly did!

    LS


    Lloyd Sheen

    If there was another way to create a visual studio tool window perhaps. Post being in the wpf forum my have something to do with it also. I guess a lot of people on here post where ever they want with out fully understanding the Microsoft's technology stack. Thanks for the feedback sqlguy. I will start another thread in my original forum leaving out any traces of "wpf" or "user control". Kind of hard since it's the only way you can do it, but Ill give it a shot. Sad, I could have had an answer already or given a good recommendation at minimum 23 hours later.
    Tuesday, June 19, 2012 1:34 AM
  • Hi sarbaje,

    I'm sorry for misunderstanding your issue. I have seen your new thread and I'm doing some researches.

    There might be some time delay. Appreciate your patience.
     
    Thank you for your understanding and support.

    Best regards,

    Ego


    Tuesday, June 19, 2012 2:41 AM
  • Oh, sorry for our moving action, I will help to merge it back to your new thread. And did you view this solution: http://www.nachmore.com/2010/create-a-wpf-based-toolwindow-in-your-add-in/

    Bob Bao [MSFT]
    MSDN Community Support | Feedback to us

    • Marked as answer by sarbaje Tuesday, June 19, 2012 4:32 AM
    Tuesday, June 19, 2012 3:56 AM
  • Wow that worked!! Thank you so much Bob!

    If anyone else runs into this problem make sure you also disable the "register for com interop" if you have it ticked in the user control project properties. 

    Tuesday, June 19, 2012 4:34 AM