Attach visual studio debugger to electron app

后端 未结 3 744
梦谈多话
梦谈多话 2020-12-29 07:15

I\'m attempting to debug electron app from visual studio 2017 (and not vscode) from scratch.

I created a console nodejs project, install and save electron. Project s

相关标签:
3条回答
  • 2020-12-29 07:49

    This is actually very easy to do.

    1. Configure your app in Visual Studio like this:

    1. Start your app. Electron will start on a separate terminal but Visual Studio won't be attached to it.

    1. Go to Debug > Attach to process... and enter the Webkit websocket connection type and http://127.0.0.1:5858 as the target.

    2. Your breakpoints are now enabled.

    0 讨论(0)
  • 2020-12-29 07:53

    In your "Node.exe Options" field, add --debug=$DEBUG_PORT for NodeJS v6 and below or --inspect=$DEBUG_PORT for NodeJS v7 or greater where $DEBUG_PORT is meant to symbolize the port you have specified in your debug configuration.

    If you don't pass a port and only pass the --debug or --inspect flag, then Node debugger listens on ports 5858 and 9229 respectively... they changed the default port to 9229 in later versions of node.

    Let me know if this helps!

    0 讨论(0)
  • 2020-12-29 07:59
    • First you have to configure your Visual Studio to GitHub Symbols.
    • Attaching to and Debugging Electron -> To start a debugging session, open up PowerShell/CMD and execute your debug build of Electron, using the application to open as a parameter.

      $ ./out/D/electron.exe ~/my-electron-app/
      
    • For complete documentation read here.


    For seeing why symbols are not loading type the following commands in Windbg.

    > !sym noisy
    > .reload /f electron.exe
    

    Creating an Electron app using Visual Studio (not VSCode) w/ Node.js tools

    0 讨论(0)
提交回复
热议问题