vscode-azurefunctions icon indicating copy to clipboard operation
vscode-azurefunctions copied to clipboard

No longer see process when attempting to debug .NET function

Open PleaseStopAsking opened this issue 3 years ago • 4 comments

We are seeing issues with a move to V4 of the runtime along with .NET6.0. When attempting to set breakpoints and debug, the function builds and then kicks off func: host start just fine but the debugger goes away the second it shows as attached. I have tried to workaround mentioned here (https://github.com/microsoft/vscode-azurefunctions/issues/2831#issuecomment-854282062) and noticed that I am not seeing a process that correlates with my project name. I tested with every single dotnet process listed, and none are correct of course.

Details

  • Latest Azure Functions extension as of 11/24/2021
  • Latest .NET 6.0 SDK as of 11/24/2021
  • Latest C# extension as of 11/24/2021
  • MacOS Monterey
  • VS Code 1.62.3

settings.json

{
    "azureFunctions.deploySubpath": "bin/Release/net6.0/publish",
    "azureFunctions.projectLanguage": "C#",
    "azureFunctions.projectRuntime": "~4",
    "debug.internalConsoleOptions": "neverOpen",
    "azureFunctions.preDeployTask": "publish"
}

launch.json

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Attach to .NET Functions",
            "type": "coreclr",
            "request": "attach",
            //"processId": "${command:azureFunctions.pickProcess}",
            "processId": "${command:pickProcess}",
            "preLaunchTask": "func: host start"
        },
    ]
}

tasks.json

{
    "version": "2.0.0",
    "tasks": [
        {
            "label": "clean",
            "command": "dotnet",
            "args": [
                "clean",
                "/property:GenerateFullPaths=true",
                "/consoleloggerparameters:NoSummary"
            ],
            "type": "process",
            "problemMatcher": "$msCompile"
        },
        {
            "label": "build",
            "command": "dotnet",
            "args": [
                "build",
                "/property:GenerateFullPaths=true",
                "/consoleloggerparameters:NoSummary"
            ],
            "type": "process",
            "dependsOn": "clean",
            "group": {
                "kind": "build",
                "isDefault": true
            },
            "problemMatcher": "$msCompile"
        },
        {
            "label": "clean release",
            "command": "dotnet",
            "args": [
                "clean",
                "--configuration",
                "Release",
                "/property:GenerateFullPaths=true",
                "/consoleloggerparameters:NoSummary"
            ],
            "type": "process",
            "problemMatcher": "$msCompile"
        },
        {
            "label": "publish",
            "command": "dotnet",
            "args": [
                "publish",
                "--configuration",
                "Release",
                "/property:GenerateFullPaths=true",
                "/consoleloggerparameters:NoSummary"
            ],
            "type": "process",
            "dependsOn": "clean release",
            "problemMatcher": "$msCompile"
        },
        {
            "type": "func",
            "dependsOn": "build",
            "options": {
                "cwd": "${workspaceFolder}/bin/Debug/net6.0"
            },
            "command": "host start",
            "isBackground": true,
            "problemMatcher": "$func-watch"
        }
    ]
}

Process Picker 2021-11-24_07-40-39

PleaseStopAsking avatar Nov 24 '21 12:11 PleaseStopAsking

Hi, we're also having the same issue. I posted over on OmniSharp as I wasn't sure where the fault was.

https://github.com/OmniSharp/omnisharp-vscode/issues/4903

davec643 avatar Nov 24 '21 13:11 davec643

I have verified that this workaround allows me to debug .NET 6.0 Functions on macOS Monterey 12.1.

alexweininger avatar Jan 27 '22 00:01 alexweininger

@PleaseStopAsking were you able to try the workaround mentioned above?

alexweininger avatar Jun 28 '22 00:06 alexweininger

i have to do the same thing with C# on windows but when pick a process comes up: I have to look for func and attach to that, debugging works after that.

Signing exes with self signed does not help

james2432 avatar Aug 23 '22 09:08 james2432

I've needed to refer back to @basilfx's workaround so often that I've turned it into a blog post here: https://blog.johnnyreilly.com/2022/11/11/debugging-azure-functions-vs-code-mac-os (credit attributed to @basilfx)

johnnyreilly avatar Nov 11 '22 19:11 johnnyreilly