当调试器开始使用代码时,我正在尝试附加到第二个进程:
DTE dte = BuildaPackage.VS_DTE;
EnvDTE.Process localServiceEngineProcess = dte.Debugger.LocalProcesses
.Cast<EnvDTE.Process>()
.FirstOrDefault(process => process.Name.Contains("ServiceMonitor"));
if (localServiceEngineProcess != null) {
localServiceEngineProcess.Attach();
}
当调试器未运行时它工作正常,但是在事件期间尝试附加时尝试附加时VS_DTE.Events.DebuggerEvents.OnEnterRunMode
,我收到错误:
A macro called a debugger action which is not allowed while responding to an event or while being run because a breakpoint was hit.
调试器启动时如何附加到另一个进程?