I'm running into a different problem as well here. I'm getting this error message when I attempt to trigger a custom menu item added by a VSIP Package using the DTE automation.
I have a regular winforms application that launches an instance of Visual Studio and gets the DTE object that it exposes through OLE Automation. I have a VSIP Package registered that is essentially a slightly modified ToolWindow that adds a menu to the View menu. I've noticed that the VSIP Package doesnt load up until the menu item is clicked, so as a quick work around, I want to trigger that window just to force the VSIP Package to load up. I'm doing that with DTE.ExecuteCommand("View.MyToolWindowVB").
When this is called, an exception is thrown indicating that the call was rejected. I can manually select that menu item no problem, and I can trigger other menu items (ie "File.NewProject") without problems. Any ideas why I cant trigger this menu item?
The full exception text is below.
Bill
System.Runtime.InteropServices.COMException was unhandled
ErrorCode=-2147418111
Message="Call was rejected by callee. (Exception from HRESULT: 0x80010001 (RPC_E_CALL_REJECTED))"
Source="EnvDTE"
StackTrace:
at EnvDTE._DTE.ExecuteCommand(String CommandName, String CommandArgs)
at automationtest.Form1.Button1_Click(Object sender, EventArgs e) in C:\Documents and Settings\administrator.jnetd\my documents\visual studio 2005\Projects\automationtest\automationtest\Form1.vb:line 58
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(ApplicationContext context)
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)
at automationtest.My.MyApplication.Main(String[] Args) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 77
at System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
I have a regular winforms application that launches an instance of Visual Studio and gets the DTE object that it exposes through OLE Automation. I have a VSIP Package registered that is essentially a slightly modified ToolWindow that adds a menu to the View menu. I've noticed that the VSIP Package doesnt load up until the menu item is clicked, so as a quick work around, I want to trigger that window just to force the VSIP Package to load up. I'm doing that with DTE.ExecuteCommand("View.MyToolWindowVB").
When this is called, an exception is thrown indicating that the call was rejected. I can manually select that menu item no problem, and I can trigger other menu items (ie "File.NewProject") without problems. Any ideas why I cant trigger this menu item?
The full exception text is below.
Bill
System.Runtime.InteropServices.COMException was unhandled
ErrorCode=-2147418111
Message="Call was rejected by callee. (Exception from HRESULT: 0x80010001 (RPC_E_CALL_REJECTED))"
Source="EnvDTE"
StackTrace:
at EnvDTE._DTE.ExecuteCommand(String CommandName, String CommandArgs)
at automationtest.Form1.Button1_Click(Object sender, EventArgs e) in C:\Documents and Settings\administrator.jnetd\my documents\visual studio 2005\Projects\automationtest\automationtest\Form1.vb:line 58
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(ApplicationContext context)
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)
at automationtest.My.MyApplication.Main(String[] Args) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 77
at System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()