13

I am trying to run azure on my PC. I am using VS Code, Windows 64 bit

I have installed Azure SDK - .NET Core 2.2.x SDK - Cosmos Emulator - Storage Emulator and also installed azure-functions-core-tools V2

when i try to run debugger by using f5 key , I am getting below error

enter image description here

Community
  • 1
  • 1
Sudharshan Nair
  • 1,152
  • 1
  • 10
  • 24

13 Answers13

20

I fixed this by installing the Azure Functions extension for Visual Studio Code then restarting Visual Studio Code.

Changing terminal did not help.

Alastair
  • 201
  • 2
  • 3
8

I resolved this by ensuring I was connected to Azure. Opening Azure on the side menu (Shift+Alt+A) was sufficient.

EnterpriseMike
  • 165
  • 2
  • 7
6

I had a similar problem. I started VSCode as an Administrator and debugging worked as expected.

Ismail
  • 101
  • 1
  • 2
4

I believe this was because your VSCode instance is set to use version 5.0 of Powershell when debugging. I followed these instructions on my machine to reference Powershell Core 6 instead and the debugging worked flawlessly afterward. I intend to put it back for normal development so that I use v5.0 for day-to-day work:

  1. In VSCode: Ctrl-Shift-P
  2. Preferences: Open User Settings Search for: terminal.integrated.shell.windows
  3. Save the original value: "C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe" (for use after you finish playing with Azure Functions In Powershell)
  4. Replace it with the new value: "c:/Program Files/PowerShell/6/pwsh.exe"
  5. Save
  6. Restart VSCode
Thorsky666
  • 41
  • 4
3

If its a fresh installation of VS Code, this happens if the Python Extension is not installed. Install the recommended extensions and this error went away

Priya
  • 31
  • 1
2

I had Azure Functions extension installed already. Restarting VS Code resolved the issue.

Fayyaz Naqvi
  • 695
  • 7
  • 19
1

In my case, the solution was simpler. There was some malformed json code in host.json. As soon as I fixed it, I was able to run the debugger again.

I would review host.json and see if you have the same problem. I hope that helps!

Irina
  • 1,333
  • 3
  • 17
  • 37
0

This happened when updated the VS code version.

Try uninstalling and reinstalling azure functions extention. It should work then.

Rushi patel
  • 522
  • 7
  • 17
0

Assuming you have Azure Function Extensions installed correctly, another way you can see this error is if you change the command line arguments in tasks.json, this will change the generated task label. You can solve it by manually setting the label to match the previously generated one.

Example:

{
  "version": "2.0.0",
  "tasks": [
    {
      "label": "func: host start",
      "type": "func",
      "command": "host start --port 5022",
      "problemMatcher": "$func-node-watch",
      "isBackground": true,
      "dependsOn": "npm build (functions)"
    },
    ...
  ]
}

Alternatively you can update the task reference in launch.json to include the command line arguments, but setting the task label will be more resilient to future configuration changes.

Jason
  • 506
  • 3
  • 14
0

One hack that is working is deploying the Azure Functions to a Function app (not used) from VS Code itself. After this, the functions are running/debugging normally after pressing F5. What I infer is that deployment is initiating the right of terminals or resetting some background variables to right values.

sprash95
  • 137
  • 9
0

I faced a similar issue, VSC asked me to install the Azure Functions Core Tools, but after I did, I got the message "Could not find the Task 'func : host start'". This happend each time I pressed F5.

None of the solutions from above worked.But finally, I managed to solve it with the method described by @ValentinPetkov:

choco install azure-functions-core-tools-3 --params="'/x64:true'"
Jeremy Caney
  • 7,102
  • 69
  • 48
  • 77
-1

I had the same issue. Compared the tasks.jason file with that of another project that worked fine and found no difference. Saved my workspace and re-launched vscode. That worked without changing any thing

-1

I fixed mine using these steps:

  1. Press F1, type settings.json to open the local settings.json file.

  2. Look for the key "terminal.integrated.automationShell.windows" and update to:

    "terminal.integrated.automationShell.windows": "c:\windows\system32\cmd.exe"

kots
  • 465
  • 2
  • 7