Freigeben über


Why can't I detach the debugger from an app?

An interesting internal thread on debugging went by, and it was news to me, so figured I'd share.

In the VS2005 debugger, you can't detach from a running app (that is, stop debugging but leave the target process alive)  if you're debugging in mixed mode (native and managed simultaneously.)

Comments

  • Anonymous
    January 12, 2006
    That's a good question, what's the answer?
  • Anonymous
    January 13, 2006
    AFAIK you could not do this is VC6 either, or VS2003 - even in native mode. So what is the reason for this?
  • Anonymous
    January 13, 2006
    Don't remember what the story with VS 2003 was (it's been almost 2 years since I've used it.) The VS2005 debugger behavior, as given by a debugger dude:

    If you attach to your app, when you stop debugging you will automatically detach without killing the app.

    If you launch your app under the debugger, you can detach by choosing the Debug->Detach All menu item. Otherwise, stop debugging will automatically terminate the app.
  • Anonymous
    January 13, 2006
    VC6 couldnt do it for Native because its release (in 1998) preceeded the OS support for Detach (ie XP).

    VS7.0 and later can do it for Native (Seth is mistaken).

    Nothing can do it for Mixed because the debugging services support in the CLR doesn't include Detach support.
  • Anonymous
    January 15, 2006
    Ummm, is the answer going to be posted by anyone who knows the answer? In the VS2005 debugger, if you're debugging in mixed native and managed mode, why can't you detach?
  • Anonymous
    January 16, 2006
    As Andy said, VS doesn't support it because the CLR doesn't support it.

    So then I guess the question becomes -- why doesn't the CLR support it? Interop debugging is hard, and it was implemented in a way that made detach too difficult to implement.

    The CLR is currently working on reimplementing interop debugging for a future version. With the new architecture, detach should be much more reasonable.
  • Anonymous
    January 16, 2006
    I swear Andy Pennell's answer wasn't displayed yet when I asked.

    Though actually I'm still confused. If the debugging services support in the CLR doesn't include Detach support then even Managed (without mixing) wouldn't be capable?
  • Anonymous
    March 01, 2006
    Matt Pietrek noticed you can't detach while interop-debugging (aka "mixed-mode") in VS. Short answer:...