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

Unable to Start or Debug Azure Function from VSCode on MacOS

Open rlvandaveer opened this issue 2 years ago • 1 comments

I am unable to start or debug any Azure Functions on multiple Macs. When I click Debug -> Attach to .NET Functions it kicks off a myriad of tasks and finally func host start. All seems to go well until the function starts and then it abruptly aborts:

Executing task: func host start <

Azure Functions Core Tools
Core Tools Version:       4.0.4483 Commit hash: N/A  (64-bit)
Function Runtime Version: 4.1.3.17473

[2022-05-17T01:56:06.853Z] Found /Users/omitted/Code/Sandbox/http-azure-fun/http-azure-fun.csproj. Using for user secrets file configuration.

Functions:

        httpFunc: [GET,POST] http://localhost:7071/api/httpFunc

For detailed output, run func with --verbose flag.
The terminal process "/usr/local/bin/pwsh '-c', 'func host start'" terminated with exit code: 143.

Terminal will be reused by tasks, press any key to close it.

I can run any function from outside VSCode without problem. While functions execute just fine from a terminal, I cannot seem to attach and debug them. Using a standard .NET Core Attach launch configuration and selecting the func start process causes VSCode to process for a moment and then stops. No message is shown, no output is produced in any pane I can find.

dotnet --version
6.0.300

PowerShell 7.2.3

VSCode Version: 1.67.1 Commit: da15b6fd3ef856477bf6f4fb29ba1b7af717770d Date: 2022-05-06T12:37:16.526Z Electron: 17.4.1 Chromium: 98.0.4758.141 Node.js: 16.13.0 V8: 9.8.177.13-electron.0 OS: Darwin x64 21.4.0

Azure Function Extension v1.6.2

rlvandaveer avatar May 17 '22 02:05 rlvandaveer

I'm able to reproduce this myself with PowerShell, as well as with zsh.

.NET debugging on macOS has been flakey for a lot of users recently. However, this workaround has fixed it for some users.

Could you try that workaround and let us know if it fixes the issue?

Related issues:

  • https://github.com/microsoft/vscode-azurefunctions/issues/3009
  • https://github.com/Azure/Azure-Functions/issues/2071
  • https://github.com/OmniSharp/omnisharp-vscode/issues/4903
  • https://github.com/microsoft/vscode-azurefunctions/issues/3058

alexweininger avatar Jun 28 '22 00:06 alexweininger

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