Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Start Debugger "from running program"

Start Debugger "from running program"

Scheduled Pinned Locked Moved C#
questiondebugging
5 Posts 5 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    Tomerland
    wrote on last edited by
    #1

    I have a question, starting the debugger somehow indirectly, in this szenario: 1) I start a dot-net-executable within a batch-file 2) When this exe is started from the batch, I want, that the debugger is started "automatically", so that I have the chance to trace the running exe (e.g. by breakpoints) Question: How can I start the debugger this way? Thank you

    P L M J 4 Replies Last reply
    0
    • T Tomerland

      I have a question, starting the debugger somehow indirectly, in this szenario: 1) I start a dot-net-executable within a batch-file 2) When this exe is started from the batch, I want, that the debugger is started "automatically", so that I have the chance to trace the running exe (e.g. by breakpoints) Question: How can I start the debugger this way? Thank you

      P Offline
      P Offline
      PIEBALDconsult
      wrote on last edited by
      #2

      Maybe wait for it to throw an unhandled Exception? But seriously, you can't do it that way. If you're using Visual Studio to develop the app you can attach the debugger to a running app by opening the solution and using the menu: Debug | Attach to process... then select the process from the list. What I have done with Windows Services is have them pause for a minute when they start so I have time to attach the debugger; you may need to do something like that.

      1 Reply Last reply
      0
      • T Tomerland

        I have a question, starting the debugger somehow indirectly, in this szenario: 1) I start a dot-net-executable within a batch-file 2) When this exe is started from the batch, I want, that the debugger is started "automatically", so that I have the chance to trace the running exe (e.g. by breakpoints) Question: How can I start the debugger this way? Thank you

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #3

        From code? System.Diagnostics.Debugger.Launch[^]

        Bastard Programmer from Hell :suss: if you can't read my code, try converting it here[^]

        1 Reply Last reply
        0
        • T Tomerland

          I have a question, starting the debugger somehow indirectly, in this szenario: 1) I start a dot-net-executable within a batch-file 2) When this exe is started from the batch, I want, that the debugger is started "automatically", so that I have the chance to trace the running exe (e.g. by breakpoints) Question: How can I start the debugger this way? Thank you

          M Offline
          M Offline
          markovl
          wrote on last edited by
          #4

          You can launch the JIT debugger from the batch file (with the %WINDIR%\System32\vsjitdebugger.exe util), after you've successfully started your app. For instructions on how to do it refer to this link: Answer 3[^]

          2A

          1 Reply Last reply
          0
          • T Tomerland

            I have a question, starting the debugger somehow indirectly, in this szenario: 1) I start a dot-net-executable within a batch-file 2) When this exe is started from the batch, I want, that the debugger is started "automatically", so that I have the chance to trace the running exe (e.g. by breakpoints) Question: How can I start the debugger this way? Thank you

            J Offline
            J Offline
            jschell
            wrote on last edited by
            #5

            I use the following for debugging on my dev machine System.Diagnostics.Debugger.Assert(false); When it executes it pops a dialog that asks for the debugger to run via the 'retry' option on the first popup. Once the debugger starts there is a break point on the above line. There are limitations to this such as where the app is running and timeout issues with execution threads (with the debug line).

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups