title: Attach visual studio debugger to electron app
body: <p>I'm attempting to debug electron app from visual studio 2017 (and not vscode) from scratch.</p>
  
  <p>I created a console nodejs project, install and save electron. Project structure:
   <a href="https://i.stack.imgur.com/SGytB.png" rel="noreferrer"><img src="https://i.stack.imgur.com/SGytB.png" alt="enter image description here"></a></p>
  
  <p>Content of <code>app.js</code> (taken from website of electron):</p>
  
  <pre><code>'use strict';
  
  const { app, BrowserWindow } = require('electron')
  const path = require('path')
  const url = require('url')
  
  // Keep a global reference of the window object, if you don't, the window will
  // be closed automatically when the JavaScript object is garbage collected.
  let win
  
  function createWindow() {
      // Create the browser window.
      win = new BrowserWindow({ width: 800, height: 600 })
  
      // and load the index.html of the app.
      win.loadURL(url.format({
          pathname: path.join(__dirname, 'index.html'),
          protocol: 'file:',
          slashes: true
      }))
  
      // Open the DevTools.
      win.webContents.openDevTools()
  
      // Emitted when the window is closed.
      win.on('closed', () =&gt; {
          // Dereference the window object, usually you would store windows
          // in an array if your app supports multi windows, this is the time
          // when you should delete the corresponding element.
          win = null
      })
  }
  
  // This method will be called when Electron has finished
  // initialization and is ready to create browser windows.
  // Some APIs can only be used after this event occurs.
  app.on('ready', createWindow)
  
  // Quit when all windows are closed.
  app.on('window-all-closed', () =&gt; {
      // On macOS it is common for applications and their menu bar
      // to stay active until the user quits explicitly with Cmd + Q
      if (process.platform !== 'darwin') {
          app.quit()
      }
  })
  
  app.on('activate', () =&gt; {
      // On macOS it's common to re-create a window in the app when the
      // dock icon is clicked and there are no other windows open.
      if (win === null) {
          createWindow()
      }
  })
  
  // In this file you can include the rest of your app's specific main process
  // code. You can also put them in separate files and require them here.
  </code></pre>
  
  <p>And <code>index.html</code></p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
      &lt;meta charset="UTF-8"&gt;
      &lt;title&gt;Hello World!&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;h1&gt;Hello World!&lt;/h1&gt;
      We are using node
      &lt;script&gt;document.write(process.versions.node)&lt;/script&gt;,
      Chrome
      &lt;script&gt;document.write(process.versions.chrome)&lt;/script&gt;,
      and Electron
      &lt;script&gt;document.write(process.versions.electron)&lt;/script&gt;.
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>However, when I click start, the electron app starts, but the debugging process seems to detach itself. When I try to manually attach the debugger to all electron process (Debug -> Attach to process -> choose all electron processes), the break point claims not to be hit since no symbols are loaded.
  <a href="https://i.stack.imgur.com/REg0w.png" rel="noreferrer"><img src="https://i.stack.imgur.com/REg0w.png" alt="enter image description here"></a></p>
  
  <p>This is the project property page:
  <a href="https://i.stack.imgur.com/ARDtA.png" rel="noreferrer"><img src="https://i.stack.imgur.com/ARDtA.png" alt="enter image description here"></a></p>
  
  <p>Is there a step that I missed? Since debugging can be done on VSCode, I assume it can also be done in VS2017?</p>
  
  <p>Many thanks.</p>
  
  <p>NOTE: I did check Suppress JIT optimization and uncheck Enable just my code.</p>