0

I'm trying to debug a UWP application, and break on startup. However, when I start the application with windbg, the breakpoint didn't work.

After further digging I found the process is started by system service instead of the explorer, e.g

enter image description here

Any ideas on how to debug UWP application and break on startup?

1 Answer 1

1

Registry

Typically you would add an entry into the Image File Execution Options registry area, which lets you invoke a debugger as soon as the named exe is launched.

Assuming a 64bit service:

  • Key: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\App1.exe
  • Value: debugger REG_SZ
  • Data: "C:\Program Files (x86)\Windows Kits\10\Debuggers\x64\windbg.exe"

Notice the name of your exe in the Key path, and any specific debugger (and command line parameters) can be specified.

For 32-bit services, add your new entry to the HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\[app.exe] path.

Just remember to delete (or temporarily rename) the registry when done debugging.

DebugBreak

Alternately, you can add a call to DebugBreak at the start of your process. Its worthwhile to add the check for an app-specific registry setting before calling DebugBreak, that way it is easy to turn on and off.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.