visual-studiodebuggingelectronvisual-studio-2019attach-to-process

Debugging Electron renderer process through Visual Studio


I have an Electron app that I'm debugging in VSCode. In my app, I create a BrowserView and load one of my websites: browserView.webContents.loadURL(myUrl);

Sometimes, I want to debug this website that's loaded in my BrowserView.

How I've been doing that is I open devtools in Electron and set breakpoints in the Chrome devtools that appears.

However, I wonder if I can spin up the localhost server from Visual Studio that hosts my website, and then debug my site directly from Visual Studio instead of through the devtools.

Is there a way to do this?

It seems like that won't work since the Visual Studio debugger is already attached and attaching it to the BrowserView's renderer process didn't work, but I wanted to check.


Solution

  • Is there a way to do this? It seems like that won't work since the Visual Studio debugger is already attached and attaching it to the BrowserView's renderer process didn't work, but I wanted to check.

    I am afraid that you cannot get what you want.

    Actually in Visual Studio, you cannot debug the renderer process. It does not support that. You have to use the Chrome devtools.

    Besides, if you want this feature, you can suggest a feature on our User Voice Forum and hope the team will give you a satisfactory reply.