将多个EnvDTE进程附加到调试器会引发异常. [英] Attaching multiple EnvDTE processes to the debugger throws an exception.

查看:110
本文介绍了将多个EnvDTE进程附加到调试器会引发异常.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试创建一个将 启动多个进程并将它们附加到打开的VS的调试器中 2005年实例.随附的代码显示了我的操作方式.当我运行它 以2个进程为例,第一个进程具有附加属性 甚至断点被击中,但是当它需要附加另一个时 我收到一个COMException:呼叫被被叫方拒绝. (来自的例外 HRESULT:0x80010001(RPC_E_CALL_REJECTED).

感谢您的帮助,
谢谢.

1 //我在本节中循环创建x进程 3 System.Diagnostics.ProcessStartInfo /font> System.Diagnostics.ProcessStartInfo( " my.exe" " args" /td>5System.Diagnostics.Process myProcess == System.Diagnostics.Process.Start(processInfo); 6 7 8 EnvDTE80.DTE2 dte =((EnvDTE80.DTE2)Marshal.GetActiveObject(''VisualStudio.DTE.8.0 " ); 9 EnvDTE.Processes procs = dte.Debugger.LocalProcesses; 10 11 尝试 { 12 foreach (在EnvDTE80.Process2proc in 处理程序{{ 13 如果 (proc.ProcessID == myProcess.Id) 14 proc.Attach(); 15 }} 16 } 17 捕获 (System.Runtime.InteropServices.COMException ex) 18 { ; } 19 20 //} 解决方案

RPC_E_CALL_REJECTED是标准的com HRESULT,表示您正在呼叫的公寓的消息过滤器暂时拒绝了您的呼叫.通常,这是因为打开了模式对话框,或者因为您是尝试输入STA的新顶级呼叫.解决此问题的正常方法是在暂停(或正常失败)后重试您的呼叫.

HTH

Jackson Davis
Visual Studio Debugger


I am trying to create an application that will launch multiple processes and attach them to the debugger of an open VS 2005 instance. The code attached shows how i'm doing it. When I run it with 2 processes for example, the first process gets attached property and even the breakpoint is hit but when its time to attach the other one I get a COMException: Call was rejected by callee. (Exception from HRESULT: 0x80010001 (RPC_E_CALL_REJECTED)).

You help is appreciated,
Thanks.

1// I loop this section to creating x processes 
2//{ 
3System.Diagnostics.ProcessStartInfo processInfo = new System.Diagnostics.ProcessStartInfo("my.exe""args"); 
4  
5System.Diagnostics.Process myProcess = System.Diagnostics.Process.Start(processInfo); 
6 
7  
8EnvDTE80.DTE2 dte = (EnvDTE80.DTE2)Marshal.GetActiveObject("VisualStudio.DTE.8.0"); 
9EnvDTE.Processes procs = dte.Debugger.LocalProcesses; 
10  
11try
12    foreach (EnvDTE80.Process2 proc in procs){ 
13        if (proc.ProcessID == myProcess.Id) 
14            proc.Attach(); 
15    } 
16
17catch (System.Runtime.InteropServices.COMException ex) 
18{          MessageBox.Show(ex.Message);    } 
19 
20//} 

解决方案

RPC_E_CALL_REJECTED is a standard com HRESULT that means the message filter for the apartment you are calling into has refused your call for the time being. Normally, this is because a modal dialog is open or because you are a new top-level call trying to enter the STA. The normal way of handling this is to retry your call after some pause (or fail gracefully)

HTH

Jackson Davis
Visual Studio Debugger


这篇关于将多个EnvDTE进程附加到调试器会引发异常.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆