473,473 Members | 1,819 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

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 1407

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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Scott Nonnenberg [MSFT] | last post by:
"The Visual Studio Debugger Do you have some burning questions or comments about SQL, C#, VB, C++, or script debugging support in Visual Studio? Want to know more about Visual Studio 2005's...
3
by: Greg B | last post by:
Created a simple Win32 application (using Visual Studio wizard)... Am using Visual Studio (Enterprise Edition) 6.0, as well as Service Pack 5. At the start of 'WinMain' function, added the...
0
by: Scott Nonnenberg [MSFT] | last post by:
We'd love to see you there! The Visual Studio Debugger "Do you have some burning questions or comments about SQL, C#, VB, C++, or script debugging support in Visual Studio? Want to know more...
2
by: Scott Nonnenberg [MSFT] | last post by:
The Visual Studio Debugger "Do you have some burning questions or comments about SQL, C#, VB, C++, or script debugging support in Visual Studio? Want to know more about Visual Studio 2005's...
0
by: Scott Nonnenberg [MSFT] | last post by:
The Visual Studio Debugger "Do you have some burning questions or comments about SQL, C#, VB, C++, or script debugging support in Visual Studio? Want to know more about Visual Studio 2005's...
0
by: Scott Nonnenberg [MSFT] | last post by:
The Visual Studio Debugger "Do you have some burning questions or comments about SQL, C#, VB, C++, or script debugging support in Visual Studio? Want to know more about Visual Studio 2005's...
1
by: DR | last post by:
What ports do i need to unblock on client and server (running msvsmon.exe) to debug remotely from my client box with visual studio 2005 pro? When I attach to remote process a connection shows up...
0
jwwicks
by: jwwicks | last post by:
Introduction This tutorial describes how to use Visual Studio to create a new C++ program, compile/run a program, resume work on an existing program and debug a program. It is aimed at the...
4
by: =?Utf-8?B?TWlrZSBHYWxl?= | last post by:
VS 2008 initially didn't debug classic ASP. SP1 fixes this in some ways. You can debug if you select the debug option to "Start Without Debugging, then either attach the debugger manually or...
3
by: Johnson | last post by:
I'm not sure if this is an IIS 5.1 issue or ASP.NET issue, or Visual Studio 2008 issue -- thus posting to 3 groups. Please don't be offended. The problem I'm encountering is that Visual Studio...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.