Visual Studio debugging

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Erik

    #1

    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.ProcessNam eArray) {
    AttachProcess(P rocessName);
    }
    }

    private void AttachProcess( string processName) {
    bool IsAttached = ProcessIsAttach ed(processName) ;
    if (! (IsAttached) ) {
    AttachProcessIf RunningLocal(pr ocessName);
    }
    }

    private bool ProcessIsAttach ed( string processName) {
    foreach ( EnvDTE.Process process in
    this.applicatio nObject.Debugge r.DebuggedProce sses){
    string CurrentProcess = process.Name.To Upper().ToStrin g();
    string[] arr = CurrentProcess. Split(new char[]{'\\'});
    CurrentProcess = arr[arr.Length - 1];
    if (processName.To Upper() == CurrentProcess)
    return true;
    }
    return false;
    }

    private void AttachProcessIf RunningLocal( string processName) {
    foreach ( EnvDTE.Process process in
    this.applicatio nObject.Debugge r.LocalProcesse s) {
    string CurrentProcess = process.Name.To Upper().ToStrin g();
    string[] arr = CurrentProcess. Split(new char[]{'\\'});
    CurrentProcess = arr[arr.Length - 1];
    if (processName.To Upper() == CurrentProcess) {
    System.Threadin g.Thread.Sleep( 100);
    process.Attach( );
    break;
    }
    }
    }
  • Jeffrey Tan[MSFT]

    #2
    RE: Visual Studio debugging


    Hi Erik,

    I found that this post has been posted in several groups. I will reply to
    you in the microsoft.publi c.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: erik.reiter@int el.com (Erik)
    | Newsgroups:
    microsoft.publi c.vsnet.debuggi ng,microsoft.pu blic.vsnet.gene ral,microsoft.p u
    blic.vsnet.ide, microsoft.publi c.dotnet.langua ges.csharp,micr osoft.public.do t
    net.general
    | Subject: Visual Studio debugging
    | Date: 5 Nov 2003 15:32:17 -0800
    | Organization: http://groups.google.com
    | Lines: 52
    | Message-ID: <4579c3b3.03110 51532.30993d5f@ 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: groups-abuse@google.co m
    | NNTP-Posting-Date: Wed, 5 Nov 2003 23:32:18 +0000 (UTC)
    | Path:
    cpmsftngxa06.ph x.gbl!TK2MSFTNG P08.phx.gbl!new s-out.cwix.com!ne wsfeed.cwix.co
    m!news.maxwell. syr.edu!postnew s1.google.com!n ot-for-mail
    | Xref: cpmsftngxa06.ph x.gbl microsoft.publi c.vsnet.general :14254
    microsoft.publi c.vsnet.ide:906 7
    microsoft.publi c.dotnet.langua ges.csharp:1970 40
    microsoft.publi c.dotnet.genera l:114529 microsoft.publi c.vsnet.debuggi ng:4050
    | X-Tomcat-NG: microsoft.publi c.dotnet.langua ges.csharp
    |
    | 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.ProcessNam eArray) {
    | AttachProcess(P rocessName);
    | }
    | }
    |
    | private void AttachProcess( string processName) {
    | bool IsAttached = ProcessIsAttach ed(processName) ;
    | if (! (IsAttached) ) {
    | AttachProcessIf RunningLocal(pr ocessName);
    | }
    | }
    |
    | private bool ProcessIsAttach ed( string processName) {
    | foreach ( EnvDTE.Process process in
    | this.applicatio nObject.Debugge r.DebuggedProce sses){
    | string CurrentProcess = process.Name.To Upper().ToStrin g();
    | string[] arr = CurrentProcess. Split(new char[]{'\\'});
    | CurrentProcess = arr[arr.Length - 1];
    | if (processName.To Upper() == CurrentProcess)
    | return true;
    | }
    | return false;
    | }
    |
    | private void AttachProcessIf RunningLocal( string processName) {
    | foreach ( EnvDTE.Process process in
    | this.applicatio nObject.Debugge r.LocalProcesse s) {
    | string CurrentProcess = process.Name.To Upper().ToStrin g();
    | string[] arr = CurrentProcess. Split(new char[]{'\\'});
    | CurrentProcess = arr[arr.Length - 1];
    | if (processName.To Upper() == CurrentProcess) {
    | System.Threadin g.Thread.Sleep( 100);
    | process.Attach( );
    | break;
    | }
    | }
    | }
    |

    Comment

    Working...