Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Debugger not attaching when running via workspaces #1517

Closed
meds opened this issue Sep 26, 2019 · 6 comments
Closed

Debugger not attaching when running via workspaces #1517

meds opened this issue Sep 26, 2019 · 6 comments

Comments

@meds
Copy link

meds commented Sep 26, 2019

I have a workspace set up with a few projects, one of which is an azure functions one with the following config:


{
  "version": "0.2.0",
  "configurations": [
    {
      "name": "Compile in watch mode",
      "type": "node",
      "request": "launch",
      "preLaunchTask": "tsc"
    },
    {
      "name": "Attach to Node Functions",
      "type": "node",
      "request": "attach",
      "port": 9230,
      "preLaunchTask": "func: host start"
    },
    {
      "name": "Attach",
      "type": "node",
      "request": "attach",
      "port": 9229,
      "processId": "${command:PickProcess}"
    },
  ],
  "compounds": [
    {
      "name": "Azure",
      "configurations": ["Attach to Node Functions"]
    }
  ]
}

When I run "Attach to Node Functions" in VSCode through the azure functions in workspaces the debugger does not attach (breakpints don't hit), there's a constant loading under the debug picker.

If I open the functions folder and run the same launch config it works fine and connects.

The terminal has no output indicating any errors.

@ejizba
Copy link
Contributor

ejizba commented Sep 26, 2019

@meds perhaps this wiki page will help: https://github.com/microsoft/vscode-azurefunctions/wiki/Multiple-function-projects

It has examples on how best to run multiple projects in one workspace

@ejizba ejizba added the info-needed See https://aka.ms/azcodeissuereporting label Oct 3, 2019
@meds
Copy link
Author

meds commented Oct 15, 2019

@meds perhaps this wiki page will help: https://github.com/microsoft/vscode-azurefunctions/wiki/Multiple-function-projects

It has examples on how best to run multiple projects in one workspace

Yes I did go through that, unfortunately no luck on my end. Really not sure what I'm doing wrong...

If I run the azure functions seperately and then attach to it with workspaces open via:

    {
      "name": "Attach",
      "type": "node",
      "request": "attach",
      "port": 9227,
      "processId": "${command:PickProcess}"
    }

breakpoints hit fine, it's only when running the

    {
      "name": "Attach to Node Functions",
      "type": "node",
      "request": "attach",
      "port": 9230,
      "preLaunchTask": "func: host start"
    },

That it won't attach and there's a progress indicator under the debug options.

@meds
Copy link
Author

meds commented Oct 15, 2019

ok I decided to wholesale copy the configs from your linked examples, it works great now with the debugger attaching through workspaces.

Unfortuantely I'm running typescript and having tsc -w running over the folder causes the functions to stop working when I change a function. Is there a way around this?

edit: after some investigation I found the secret sauce is:

    {
      "type": "func",
      **"command": "host start",**
      "problemMatcher": "$func-watch",
      "isBackground": true,
      "dependsOn": "npm build",
    },

Where if the command is replaced with npm start breakpoints stop working for workspaces but typescript recompiling does not kill the functions process.

host start means breakpoints work in workspaces but ts recompiling kills the functions process.

@ejizba
Copy link
Contributor

ejizba commented Oct 15, 2019

There's a known issue where changing a file will stop the debug session. See the following:
#781
Azure/azure-functions-host#3543

Unfortunately we don't have a solution yet

@meds
Copy link
Author

meds commented Oct 17, 2019

There's a known issue where changing a file will stop the debug session. See the following:
#781
Azure/azure-functions-host#3543

Unfortunately we don't have a solution yet

Ah, very curiously if you use the following task with tsc -w:

    {
      "type": "func",
      "command": "npm start",
      "problemMatcher": "$func-watch",
      "isBackground": true,
      "dependsOn": "npm build",
    },
    },
    {
      "type": "shell",
      "label": "npm build",
      "command": "npm run build",
      "dependsOn": [
        "func: extensions install",
      ],
      "problemMatcher": "$tsc"
    },

Run time recompiling works without crashing and the debugger does not disconnect.

That was my original task in the first post but it doesn't work in workspaces.

I'll post in that thread. If we could just fix workspaces debugger attaching with the config above it would solve all the problems.

@ejizba
Copy link
Contributor

ejizba commented Nov 5, 2019

Closing in favor of the other linked issues

@ejizba ejizba closed this as completed Nov 5, 2019
@ejizba ejizba added duplicate and removed info-needed See https://aka.ms/azcodeissuereporting labels Nov 5, 2019
@vscodebot vscodebot bot locked and limited conversation to collaborators Dec 20, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants