azureazure-functionsazure-functions-core-tools

Could not load type Microsoft.Azure.WebJobs.ParameterBindingData


I am currently developing an Azure Function in VS Code. I am encountering an error that has already been reported in this GitHub issue. In full, the error reads: Microsoft.Azure.WebJobs.Extensions.ServiceBus: Could not load type 'Microsoft.Azure.WebJobs.ParameterBindingData' from assembly 'Microsoft.Azure.WebJobs, Version=3.0.34.0, Culture=neutral, PublicKeyToken=****'. Value cannot be null. (Parameter 'provider')

One of the suggested solutions is to downgrade the package version of the Microsoft.Azure.WebJobs.Extensions.Storage. However, I do not know how to downgrade a package from an extension bundle. In my local development environment, I'm using the following default host.json configuration:

{
  "version": "2.0",
  "logging": {
    "applicationInsights": {
      "samplingSettings": {
        "isEnabled": true,
        "excludedTypes": "Request"
      }
    }
  },
  "extensionBundle": {
    "id": "Microsoft.Azure.Functions.ExtensionBundle",
    "version": "[3.15.0, 4.0.0)"
  }
}

I already tried multiple version ranges, each lead to the same error. Since I'm not familiar with .NET, I would appreciate any help or advice on how to downgrade the package to resolve this issue. Thank you.

Additional information: I am developing an EventHub Triggered Function locally using the test trigger:

@app.function_name(name="EventHubTrigger1")
@app.event_hub_message_trigger(arg_name="myhub", event_hub_name="samples-workitems",
                               connection="") 

def test_function(myhub: func.EventHubEvent):
    logging.info('Python EventHub trigger processed an event: %s',
                myhub.get_body().decode('utf-8'))

The local.settings.json is as follows:

{
  "IsEncrypted": false,
  "Values": {
    "FUNCTIONS_WORKER_RUNTIME": "python",
    "AzureWebJobsStorage": "UseDevelopmentStorage=true",
    "AzureWebJobsFeatureFlags": "EnableWorkerIndexing"
  }
}

Update: Another way to solve this issue was to reinstall/ update the azure function core tools using these commands:

sudo apt-get update
sudo apt-get install azure-functions-core-tools-4

Solution

  • Refer my answer in this Post to resolve the similar error code.

    Refer the answer by Jon koeter and this answer by Victoria Berra

    Make sure you delete these 2 folders from your Local machine that might be conflicting when you run the Azure Function locally:-

    enter image description here

    After deleting these 2 folders, Make sure you delete Azure Function Core tools, you can get the path to your Azure Function Core tools from Environment variable from below settings in your local machine:-

    enter image description here

    Visit > C:\Program Files\Microsoft\Azure Functions Core Tools\ and then delete the Azure Functions Core Tools folder.

    enter image description here

    Now, Install Azure Function core tools from this MS Document again and then create and run the Azure Function event grid trigger.

    I installed Azure Function Core tools again by following the link above and Created one Azure Event grid trigger locally the Trigger ran successfully like below:-

    enter image description here