microsoft / vscode-azurefunctions

Azure Functions extension for VS Code
https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-azurefunctions
MIT License
291 stars 134 forks source link

Unable to start host for debugging Azure Functions #3184

Open mdixon-equinix opened 2 years ago

mdixon-equinix commented 2 years ago

Issue Type: Bug

When I select F5 to start debugging my Azure Functions, the GUI shows "host start" task spinning for several seconds, then the Terminal displays this message:

Azure Functions Core Tools Core Tools Version: 3.0.3477 Commit hash: 5fbb9a76fc00e4168f2cc90d6ff0afe5373afc6d (64-bit) Function Runtime Version: 3.0.15584.0

Value cannot be null. (Parameter 'provider')

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

It also shows a pop-up window with this text: Exception of type 'OmniSharp.Extensions.JsonRpc.RpcErrorException' was thrown.

I have the latest version of PowerShell and the Azure Functions extensions.

Extension version: 1.6.2 VS Code version: Code 1.67.2 (c3511e6c69bb39013c4a4b7b9566ec1ca73fc4d5, 2022-05-17T18:15:52.058Z) OS version: Windows_NT x64 10.0.19044 Restricted Mode: No

System Info |Item|Value| |---|---| |CPUs|Intel(R) Xeon(R) E-2276M CPU @ 2.80GHz (12 x 2808)| |GPU Status|2d_canvas: enabled
canvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
oop_rasterization: enabled
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_renderer: enabled_on
video_decode: enabled
video_encode: unavailable_off
vulkan: disabled_off
webgl: enabled
webgl2: enabled| |Load (avg)|undefined| |Memory (System)|31.76GB (18.94GB free)| |Process Argv|--crash-reporter-id f981abc5-56ff-448f-922b-3c168723e687| |Screen Reader|no| |VM|0%|
A/B Experiments ``` vsliv368:30146709 vsreu685:30147344 python383:30185418 vspor879:30202332 vspor708:30202333 vspor363:30204092 pythonvspyl392:30443607 pythontb:30283811 pythonvspyt551:30345470 pythonptprofiler:30281270 vshan820:30294714 vstes263:30335439 pythondataviewer:30285071 vscod805cf:30301675 pythonvspyt200:30340761 binariesv615:30325510 bridge0708:30335490 bridge0723:30353136 vsaa593:30376534 vsc1dst:30438360 pythonvs932:30410667 wslgetstarted:30449410 pythonvsnew555:30457759 vscscmwlcmt:30465135 cppdebug:30492333 vsclangdf:30486550 ```
mdixon-equinix commented 2 years ago

Thank you for the suggestion. I tried it, but it did not correct the issue. I am still receiving the result “Value cannot be null. (Parameter ‘provider’)” when attempting to run my function.

From: srinath-samala @.> Sent: Friday, May 20, 2022 3:50 AM To: microsoft/vscode-azurefunctions @.> Cc: Matt Dixon @.>; Author @.> Subject: [EXTERNAL] Re: [microsoft/vscode-azurefunctions] Unable to start host for debugging Azure Functions (Issue #3184)

Deleting .vscode folder and re-initializing the project from the Azure tab in the sidebar fixed the issue for me.

— Reply to this email directly, view it on GitHubhttps://urldefense.com/v3/__https:/github.com/microsoft/vscode-azurefunctions/issues/3184*issuecomment-1132591519__;Iw!!PcPv50trKLWG!3oXO9T7aGEKGcFo98s5zhLnAKZn7OSwluiKa8o6924RABj_OASRUt2kTx38uVSNMlTtbASpy-1cGSun22cbnbjRO$, or unsubscribehttps://urldefense.com/v3/__https:/github.com/notifications/unsubscribe-auth/AVNPTGXFR2SJMH5JB3EWOZ3VK474DANCNFSM5WNO2E7A__;!!PcPv50trKLWG!3oXO9T7aGEKGcFo98s5zhLnAKZn7OSwluiKa8o6924RABj_OASRUt2kTx38uVSNMlTtbASpy-1cGSun22fefmQtZ$. You are receiving this because you authored the thread.Message ID: @.**@.>>

alexweininger commented 2 years ago

Unfortunately, this error is being thrown by the func cli. See related func cli issues.

You could file a new issue on the func cli repo: https://github.com/Azure/azure-functions-core-tools, they might have better advice 😄

A few things to try:

mdixon-equinix commented 2 years ago

Hello: I worked directly with Microsoft Support and we were able to get the issue fixed by taking these steps:

  1. Removed the extensionBundle section from host.json file
  2. Ran this command in the PowerShell terminal: func extensions install –force
  3. This analyzed my functions and reported that extension C# for Visual Studio Code (powered by OmniSharp) needed to be installed.

Once the C# for Visual Studio Code extension was installed, was able to successfully debug my PowerShell Azure Functions.

lavibhatnagar commented 2 years ago

Tried same but still getting same error

Also, removing extensionBundle section from host.json is throwing exception in host start task. host error: Microsoft.Azure.WebJobs.Script: The value of version property in extensionBundle section of host.json file is invalid or missing

cemmetje87 commented 1 year ago

I was able to resolve this to update extensionBundle in host.josn to: { "version": "2.0", "extensionBundle": { "id": "Microsoft.Azure.Functions.ExtensionBundle", "version": "[3.3.0, 4.0.0)" } }

After restarting VSCode it worked again

dadlMilestone commented 1 year ago

I was able to resolve this to update extensionBundle in host.josn to: { "version": "2.0", "extensionBundle": { "id": "Microsoft.Azure.Functions.ExtensionBundle", "version": "[3.3.0, 4.0.0)" } }

After restarting VSCode it worked again

This also worked for me, however I am curious whether using an older version of the extensionBundle will have any other consequences, can someone please confirm that downgrading is the correct path?