469,883 Members | 1,248 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,883 developers. It's quick & easy.

Visual Studio debugging

I have written an add in to the IDE that fires an event to check for
processes that have started up that are in a user specified list. If
one of them is found it will attach the debugger to the process. This
works great when the client and my server drone are the same machine,
but as soon as I deploy I can not do this remotely.

Does anybody have any suggestions on how I can enhance this so I can
attach to a remote server process when it starts up?

Hear is the code I am using:

Thanks,
Erik

private void AttachProcesses() {
foreach (string ProcessName in this.ProcessNameArray) {
AttachProcess(ProcessName);
}
}

private void AttachProcess( string processName) {
bool IsAttached = ProcessIsAttached(processName);
if (! (IsAttached) ) {
AttachProcessIfRunningLocal(processName);
}
}

private bool ProcessIsAttached( string processName) {
foreach ( EnvDTE.Process process in
this.applicationObject.Debugger.DebuggedProcesses) {
string CurrentProcess = process.Name.ToUpper().ToString();
string[] arr = CurrentProcess.Split(new char[]{'\\'});
CurrentProcess = arr[arr.Length - 1];
if (processName.ToUpper() == CurrentProcess)
return true;
}
return false;
}

private void AttachProcessIfRunningLocal( string processName) {
foreach ( EnvDTE.Process process in
this.applicationObject.Debugger.LocalProcesses) {
string CurrentProcess = process.Name.ToUpper().ToString();
string[] arr = CurrentProcess.Split(new char[]{'\\'});
CurrentProcess = arr[arr.Length - 1];
if (processName.ToUpper() == CurrentProcess) {
System.Threading.Thread.Sleep(100);
process.Attach();
break;
}
}
}
Jul 21 '05 #1
1 1273

Hi Erik,

I found that this post has been posted in several groups. I will reply to
you in the microsoft.public.vsnet.ide.
Thanks for your understanding.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

--------------------
| From: er*********@intel.com (Erik)
| Newsgroups:
microsoft.public.vsnet.debugging,microsoft.public. vsnet.general,microsoft.pu
blic.vsnet.ide,microsoft.public.dotnet.languages.c sharp,microsoft.public.dot
net.general
| Subject: Visual Studio debugging
| Date: 5 Nov 2003 15:32:17 -0800
| Organization: http://groups.google.com
| Lines: 52
| Message-ID: <45**************************@posting.google.com >
| NNTP-Posting-Host: 143.182.124.1
| Content-Type: text/plain; charset=ISO-8859-1
| Content-Transfer-Encoding: 8bit
| X-Trace: posting.google.com 1068075138 23263 127.0.0.1 (5 Nov 2003
23:32:18 GMT)
| X-Complaints-To: gr**********@google.com
| NNTP-Posting-Date: Wed, 5 Nov 2003 23:32:18 +0000 (UTC)
| Path:
cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!news-out.cwix.com!newsfeed.cwix.co
m!news.maxwell.syr.edu!postnews1.google.com!not-for-mail
| Xref: cpmsftngxa06.phx.gbl microsoft.public.vsnet.general:14254
microsoft.public.vsnet.ide:9067
microsoft.public.dotnet.languages.csharp:197040
microsoft.public.dotnet.general:114529 microsoft.public.vsnet.debugging:4050
| X-Tomcat-NG: microsoft.public.dotnet.general
|
| I have written an add in to the IDE that fires an event to check for
| processes that have started up that are in a user specified list. If
| one of them is found it will attach the debugger to the process. This
| works great when the client and my server drone are the same machine,
| but as soon as I deploy I can not do this remotely.
|
| Does anybody have any suggestions on how I can enhance this so I can
| attach to a remote server process when it starts up?
|
| Hear is the code I am using:
|
| Thanks,
| Erik
|
| private void AttachProcesses() {
| foreach (string ProcessName in this.ProcessNameArray) {
| AttachProcess(ProcessName);
| }
| }
|
| private void AttachProcess( string processName) {
| bool IsAttached = ProcessIsAttached(processName);
| if (! (IsAttached) ) {
| AttachProcessIfRunningLocal(processName);
| }
| }
|
| private bool ProcessIsAttached( string processName) {
| foreach ( EnvDTE.Process process in
| this.applicationObject.Debugger.DebuggedProcesses) {
| string CurrentProcess = process.Name.ToUpper().ToString();
| string[] arr = CurrentProcess.Split(new char[]{'\\'});
| CurrentProcess = arr[arr.Length - 1];
| if (processName.ToUpper() == CurrentProcess)
| return true;
| }
| return false;
| }
|
| private void AttachProcessIfRunningLocal( string processName) {
| foreach ( EnvDTE.Process process in
| this.applicationObject.Debugger.LocalProcesses) {
| string CurrentProcess = process.Name.ToUpper().ToString();
| string[] arr = CurrentProcess.Split(new char[]{'\\'});
| CurrentProcess = arr[arr.Length - 1];
| if (processName.ToUpper() == CurrentProcess) {
| System.Threading.Thread.Sleep(100);
| process.Attach();
| break;
| }
| }
| }
|

Jul 21 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Scott Nonnenberg [MSFT] | last post: by
reply views Thread by Scott Nonnenberg [MSFT] | last post: by
reply views Thread by Scott Nonnenberg [MSFT] | last post: by
3 posts views Thread by Johnson | last post: by
reply views Thread by Salome Sato | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.