locked
How to debug an app started by File Explorer RRS feed

  • Question

  • I am wondering if anyone could offer a tip on a simple task - debugging an app started by the File Explorer's "Open with" function.  I want to emphasize the work "started" meaning the the app is not running prior to being started by File Explorer.

    Hong

    Monday, January 20, 2014 8:10 PM

Answers

  • Do you want to debug the startup itself or do you want to debug an app after it has been launched?

    For the latter you can attach to the running process. For the former you can use gflags to force the app to launch in the debugger (see Running a Program in a Debugger ).

    You can use PLMDebug to disable lifetime management for the package so you can connect a debugger without shutting down the app (Visual Studio will handle this for you, but WinDbg requires you set it manually).

    --Rob 

    Monday, January 20, 2014 8:31 PM
    Moderator
  • Go to the project properties; choose debug tab. Then you have a group "start actions"; check there "dont lauch, but debug my code when it starts". Then press F5. You will see debugger gets active but doesnt start your application. Go to the file you want to open en do your open with action. Then if your app lauches with the debugger attached

    Microsoft Certified Solutions Developer - Windows Store Apps Using C#

    • Marked as answer by Hong (MA, USA) Tuesday, January 21, 2014 1:20 PM
    Tuesday, January 21, 2014 10:17 AM

All replies

  • Do you want to debug the startup itself or do you want to debug an app after it has been launched?

    For the latter you can attach to the running process. For the former you can use gflags to force the app to launch in the debugger (see Running a Program in a Debugger ).

    You can use PLMDebug to disable lifetime management for the package so you can connect a debugger without shutting down the app (Visual Studio will handle this for you, but WinDbg requires you set it manually).

    --Rob 

    Monday, January 20, 2014 8:31 PM
    Moderator
  • Thanks a lot for your prompt response, Rob.

    It is the former.  I am wondering if you could offer a tip on why I am getting the following after setting the debugger to:

    C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\devenv /debugexe

    With out setting the flag the app starts fine.  I tried this on two apps.



    Hong

    Monday, January 20, 2014 9:11 PM
  • I usually use windbg for this so I'm not sure offhand what you need for VS. A quick search suggests using %windir%\System32\VSJitDebugger.exe to attach the running debugger.
    Tuesday, January 21, 2014 2:51 AM
    Moderator
  • Go to the project properties; choose debug tab. Then you have a group "start actions"; check there "dont lauch, but debug my code when it starts". Then press F5. You will see debugger gets active but doesnt start your application. Go to the file you want to open en do your open with action. Then if your app lauches with the debugger attached

    Microsoft Certified Solutions Developer - Windows Store Apps Using C#

    • Marked as answer by Hong (MA, USA) Tuesday, January 21, 2014 1:20 PM
    Tuesday, January 21, 2014 10:17 AM
  • Thank you Dave.  It works exactly as I wanted.

    Hong

    Tuesday, January 21, 2014 1:22 PM