skip to Main Content

I’m working in a virtual environment in VS Code and I can’t understand why I’m getting this error:

[2022-07-19T10:00:31.580Z] A host error has occurred during startup operation '609dfded-e9f5-4fc4-b3a3-554bde11a415'.
[2022-07-19T10:00:31.582Z] Microsoft.Azure.WebJobs.Extensions.Http: Could not load file or assembly 'System.Net.Http.Formatting, Version=5.2.8.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. The system cannot find the file specified.
Value cannot be null. (Parameter 'provider')

What should I check?

12

Answers


  1. Chosen as BEST ANSWER

    My solution to this issue was to go into Windows Defender and exclude:

    C:Program FilesMicrosoftAzure Functions Core Toolsfunc.exe
    

    I then reinstalled Azure Functions Core Tools v4 and everything worked as intended.

    Ps. After excluding make sure to give time for your system to update. I restarted and all worked as intended. Hope this helps someone.


  2. I had this exact issue until Yesterday when I tried updating Azure Function Core Tools (https://learn.microsoft.com/en-us/azure/azure-functions/functions-run-local?tabs=v4%2Cwindows%2Ccsharp%2Cportal%2Cbash) That resolved the problem, and I now am able to run my function’s project using the CLI

    Login or Signup to reply.
  3. I had this issues as well, and my solution was to re-download and re-install the Azure Function Core Tools. I think installing twice fixed the issue for me.

    Login or Signup to reply.
  4. For me, relaunching Azure Functions Core Tools installer and choose repair fixed the issue. I had been encountering this issue in the last two days and it’s really annoying.

    Login or Signup to reply.
  5. Rolled back nuget package Microsoft.NET.Sdk.Functions from 4.1.3 to 4.1.1 on the Azure functions Api project.

    Rebuild solution.

    Login or Signup to reply.
  6. I believe the cause is that the Azure Functions Core Tools (henceforth AFCT) that Visual Studio (or VS Code) uses does not have the proper version of Microsoft.Azure.WebJobs.Extensions.Http.dll. Installing AFCT doesn’t affect anything directly, because VS uses its own version stored elsewhere. My strategy was to install the latest AFCT version and point VS to that new version.

    These instructions are for x64 Windows.

    1. Install latest Azure Functions Core Tools
    2. Using the below PowerShell code, move VS’s old version of AFCT, then point VS to the newly installed version

    Move old AFCT, point VS at new version

    # Find Afct in Program Files
    $PfMicrosoftPath = Join-Path -Path $env:ProgramFiles -ChildPath 'Microsoft'
    $AfctPath = Join-Path -Path $PfMicrosoftPath -ChildPath 'Azure Functions Core Tools'
    
    # Find the latest Aft in your Local AppData
    $VsAftPath = Join-Path -Path $env:LOCALAPPDATA -ChildPath 'AzureFunctionsTools'
    $VsAftReleasePath = Join-Path -Path $VsAftPath -ChildPath 'Releases'
    $VsLatestAfctPath = Get-ChildItem -Path $VsAftReleasePath | Sort-Object -Property Name -Descending | Select-Object -First 1 -ExpandProperty FullName
    $VsAfctCliPath = Join-Path -Path $VsLatestAfctPath -ChildPath 'cli_x64'
    $VsAfctBackupPath = Join-Path -Path $VsLatestAfctPath -ChildPath 'cli_x64_backup'
    
    # Move the existing AFCT and create a symlink
    Move-Item -Path $VsAfctCliPath -Destination $VsAfctBackupPath -Confirm:$true    
    New-Item -Type Junction -Path $VsAfctClipath -Target $AfctPath`
    
    Login or Signup to reply.
  7. We encountered a similar problem after updating Microsoft.Azure.WebJobs.Extensions.Http to 3.2.0
    Developers using Rider had no problems but no Visual Studio users could run our project.

    This post explained it for us: https://weblogs.asp.net/sfeldman/updating-azure-functions-tools.
    Just by creating a new azure functions project, the latest version for AzureFunctionsTools was downloaded to AppDataLocalAzureFunctionsTools.

    Then we could run the project without errors.

    Login or Signup to reply.
  8. This fixed it for me, hope it helps someone else

    • Close Visual Studio
    • Delete folder C:Users***AppDataLocalAzureFunctionsTools
    • Restart Visual Studio.
    • Launch Application, folder gets recreated.

    Taken from
    Unable to upgrade Azure Functions Core Tools, Exception "Cannot create instance of type 'NuGet.Versioning.VersionRange'"

    Login or Signup to reply.
  9. The accepted answer didn’t totally fix the issue for me, but I did find that the package Microsoft.NET.Sdk.Functions(4.1.3) does cause the issue, but I found another one does as well, so it will depend on what other packages you have in your app.

    So, start with downgrading that package to (4.1.1), if that doesn’t fix the issue, downgrade all packages and upgrade them one by one and try running the app after each upgrade.
    In my case the other package that was causing the issue along with the above package was Microsoft.Extensions.Http.Polly(7.0.0), the highest that worked for me was (6.0.11)

    Login or Signup to reply.
  10. In my case i just executed this command in my vs code project where the tool i would use was the v4 :npm install -g azure-functions-core-tools@4 --unsafe-perm true

    Login or Signup to reply.
  11. You can check your machine and use the latest version of azure-functions-coretools.
    For those are using Rider, go to settings > tools > Azure > Functions > Upgrade your tools to latest one (the version 4.0.4785 fixed my issue).

    Login or Signup to reply.
  12. Probably not the correct/enterprise way to fix this but I got it working by backing up the contents of folder

    C:Users{name}AppDataLocalAzureFunctionsToolsReleases4.32.0cli_x64

    And replacing with the contents of

    C:Program FilesMicrosoftAzure Functions Core Tools

    Restarted VS, cleaned and re ran the solution and worked straight away.

    Pls note this was for a personal project, I’m an ex full time/pro coder and this was just causing me a headache.

    I can’t guarantee it will work for all

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search