locked
__debugbreak() in Metro apps

    Question

  • I'm trying to debug a problem with launching a Metro app via a file association, but __debugbreak() seems to have no effect. How can I break into execution at startup so I can trace what's going wrong?

    Thursday, March 15, 2012 5:12 PM

All replies

  • In the Visual Studio Project Properties you can set the Debug options to attach when the app starts running rather than to launch the application.

    --Rob

    • Proposed as answer by Todd Chen Thursday, March 22, 2012 6:00 AM
    • Unproposed as answer by cdunford Monday, March 26, 2012 4:42 PM
    Thursday, March 15, 2012 5:35 PM
    Owner
  • I'm not sure what you mean here. The only Debugging option I see that looks similar to this is "Launch Application", and setting it to "No" doesn't seem to make any difference. The app still doesn't open in the debugger when it launches, and _debugbreak() still doesn't do anything.
    Thursday, March 22, 2012 1:01 PM
  • instead of __debugbreak() try using _asm int 3;

    Aptexan

    Friday, March 23, 2012 6:54 PM
  • No, int 3 doesn't work either (isn't that what _debugbreak() does, anyway?).

    Monday, March 26, 2012 4:41 PM
  • Rob, I've resolved my startup problem, but I still see this as an issue. If _debugbreak() doesn't work in Metro, there doesn't seem to be any way to debug problems at startup when the app is started via a file or protocol activation.
    Monday, March 26, 2012 4:45 PM
  • Hi cdunford,

    I found that:

    _asm int 3;

    __debugbreak();

    as a pair seem to work for me.  Either one on it's own does pretty much nothing, but when put together __debugbreak is actually evoked.

    weird.. hope this helps you


    Jim Tomasko

    • Proposed as answer by James Tomasko Tuesday, August 21, 2012 6:31 AM
    Tuesday, August 21, 2012 6:26 AM