Visual Studio Remote Debugging Extensibility

爷,独闯天下 提交于 2019-12-07 16:07:06

问题


I'm trying to attach to a remote machine with code similar to the following:

Debugger2 db (Debugger2)dte.Debugger;
Transport trans = db.Transports.Item("Default");
Process2 proc2 = (Process2)db.GetProcesses(trans, "MACHINENAME").Item("SERVICENAME");
proc2.Attach2();

I've gotten it to work by logging on through remote desktop and manually starting the debugger, but I have to stay logged in. The problem is, I don't want to stay logged into the remote machine. Is there a way to automatically launch the debugger, similar to what happens when I attach through the IDE?


回答1:


You could wrap your debugging code as a Windows service that executes at startup with hightened privileges.

However, I don't recommend that route, because based on experience I think it's over-kill for what is most likely needed. Could you expand on why you want to attach a debugger to a remote process automatically?

My guess is that you want to do something that would be best suited for WinDbg. Something similar to these.

  • Enabling windbg to break on clr exceptions
  • Configuring a service to start with windbg debugger attached

But, without more background information on what you are trying to accomplish, I'm obviously just guessing.



来源:https://stackoverflow.com/questions/272439/visual-studio-remote-debugging-extensibility

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!