azure-sdk-for-net: [BUG] Function App crashes on startup with error "Could not load type 'Microsoft.Azure.WebJobs.ParameterBindingData'"

Library name and version

Microsoft.Azure.WebJobs.Extensions.Storage 5.1.0

Describe the bug

I am upgrading a Function App from using version 5.0.1 of Microsoft.Azure.WebJobs.Extensions.Storage to 5.1.0 and now the app crashes on startup with the following error:

Could not load type ‘Microsoft.Azure.WebJobs.ParameterBindingData’ from assembly ‘Microsoft.Azure.WebJobs, Version=3.0.34.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35’.

Looking at the release notes, which point to Microsoft.Azure.WebJobs.Extensions.Storage.Blobs, it seems to have to do with version 5.1.0 of that but even explicitely referencing that package the app crashes.

The exception is thrown in Microsoft.Azure.WebJobs.Host, DefaultExtensionRegistryFactory.cs registring the extension Microsoft.Azure.WebJobs.Extensions.Storage.Blobs.Config.BlobsExtensionConfigProvider

Expected behavior

A minor version upgrade should not cause breaking changes nor a crash due to new dependencies

Actual behavior

See description, it crashes.

Reproduction Steps

I created a new Function App in VS 2022 (Version 17.4.5) and added a Blob trigger. Upgraded all packages to the latest version, leading to the csproj as shown below. It crashes on startup at the location mentioned in the description.

csproj content:

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFramework>net6.0</TargetFramework>
    <AzureFunctionsVersion>v4</AzureFunctionsVersion>
    <UserSecretsId>89d3f15b-1b40-4c46-aedd-cf39b5aaf7f9</UserSecretsId>
  </PropertyGroup>
  <ItemGroup>
    <PackageReference Include="Azure.Storage.Blobs" Version="12.15.0" />
    <PackageReference Include="Azure.Storage.Files.Shares" Version="12.13.0" />
    <PackageReference Include="Azure.Storage.Queues" Version="12.13.0" />
    <PackageReference Include="Microsoft.Azure.WebJobs.Extensions.Storage" Version="5.1.0" />
    <PackageReference Include="Microsoft.Extensions.Azure" Version="1.6.0" />
    <PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="6.0.1" />
    <PackageReference Include="Microsoft.NET.Sdk.Functions" Version="4.1.3" />
  </ItemGroup>
  <ItemGroup>
    <None Update="host.json">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </None>
    <None Update="local.settings.json">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
      <CopyToPublishDirectory>Never</CopyToPublishDirectory>
    </None>
  </ItemGroup>
</Project>

Environment

dotnet --info

.NET SDK: Version: 7.0.103 Commit: 276c71d299

Runtime Environment: OS Name: Windows OS Version: 10.0.19042 OS Platform: Windows RID: win10-x64 Base Path: C:\Program Files\dotnet\sdk\7.0.103\

Host: Version: 7.0.3 Architecture: x64 Commit: 0a2bda10e8

.NET SDKs installed: 2.0.3 [C:\Program Files\dotnet\sdk] 3.1.426 [C:\Program Files\dotnet\sdk] 5.0.408 [C:\Program Files\dotnet\sdk] 6.0.302 [C:\Program Files\dotnet\sdk] 6.0.309 [C:\Program Files\dotnet\sdk] 6.0.406 [C:\Program Files\dotnet\sdk] 7.0.101 [C:\Program Files\dotnet\sdk] 7.0.102 [C:\Program Files\dotnet\sdk] 7.0.103 [C:\Program Files\dotnet\sdk]

.NET runtimes installed: Microsoft.AspNetCore.App 3.1.18 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 3.1.25 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 3.1.27 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 3.1.28 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 3.1.30 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 3.1.32 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 6.0.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 6.0.7 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 6.0.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 6.0.10 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 6.0.12 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 6.0.13 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 6.0.14 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 7.0.1 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 7.0.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 7.0.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.NETCore.App 2.0.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 3.1.18 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 3.1.25 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 3.1.27 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 3.1.28 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 3.1.30 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 3.1.32 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 6.0.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 6.0.8 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 6.0.10 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 6.0.12 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 6.0.13 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 6.0.14 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 7.0.1 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 7.0.2 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 7.0.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.WindowsDesktop.App 3.1.18 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 3.1.25 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 3.1.27 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 3.1.28 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 3.1.30 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 3.1.32 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 6.0.7 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 6.0.8 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 6.0.10 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 6.0.12 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 6.0.13 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 6.0.14 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 7.0.1 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 7.0.2 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 7.0.3 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

Visual Studio: 17.4.5

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Reactions: 5
  • Comments: 53 (12 by maintainers)

Commits related to this issue

Most upvoted comments

As for Visual Studio not using the latest core tools version, this isn’t something I can help with

For Visual Studio you can update the core tools with this button in the options dialog which also resolved the problem for a colleague of mine. Because the installation of the standalone version isn’t respected by Visual Studio

image

Hi,

just ran into this problem. My workaround:

  • first I uninstalled all core tools (installed from msi and npm) to make sure only the one under AppData was available
  • then I shutdown my Visual Studio 2022
  • renamed AppData\Local\AzureFunctionsTools to AppData\Local_AzureFunctionTools (just in case I needed to restore it)
  • opened Visual Studio again
  • Used the check update in VS as mentioned in eberthold’s comment and then installed the updates
  • Voilá, the correct version (.5095) was installed!

I have the same issue but have no reference to Microsoft.Azure.WebJobs.Extensions.Storage. It happened when I upgraded Microsoft.Azure.WebJobs.Extensions.ServiceBus from 4.2.1 to latest (5.9.0) and that has no internal dependency on Microsoft.Azure.WebJobs.Extensions.Storage, but does depend on Microsoft.Azure.Webjobs (3.0.36). Downgrading Microsoft.Azure.WebJobs.Extensions.ServiceBus to 5.8.1 fixes the issue

We’re looking to make a hotfix release to remove this error. It was a miscommunication on our part for releasing a new feature too early before another dependency has not rolled out their feature.

We apologize for any inconvenience this may have caused and I will update the thread once the hotfix release has been made.

Same issue here. I thought this was due to me trying to bind to Azurite.

Current workaround: Downgrade to, “Microsoft.Azure.WebJobs.Extensions.Storage” version: 5.0.1

Hi, downgrading to 5.0.1 seems to resolve the issue. (Clean the solution and run) Looking forward for a fix.

I also have PTSD launching a function locally now. That first green line, and then I always see red in my mind…

I’ve upgrade to Core Tools@4.0.5085 and I can now run func start to get it working.

This is an issue with Visual Studio for Mac 17.5.7 (build 6). The function app cannot be run locally:

“Could not load type ‘Microsoft.Azure.WebJobs.ParameterBindingData’ from assembly ‘Microsoft.Azure.WebJobs, Version=3.0.34.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35’.”

I am also experiencing it with VS for Mac, 17.6.3 (build 421).

System.Private.CoreLib: Exception has been thrown by the target of an invocation. Could not load type ‘Microsoft.Azure.WebJobs.ParameterBindingData’ from assembly 'Microsoft.Azure.WebJobs, Version=3.0.34.0, Culture=neutral

Some awful combination of steps from the above solved my issues. It sucks that we’re seeking help with this HERE. I guarantee if I open up a support ticket they’d have no clue how to fix this.

Is there any update on this ? I tried the recommended solutions. Unfortunately none worked out for me. I tried to name specific versions of the extensions, yet the error still occurs:

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

Above my host.json. I use Python and am trying to eventhub trigger. Also I use WSL.

I’m blocked by this.

I’ve installed the very latest Core Tools (4.0.5030). Closed and restarted VS, but when I debug my function locally, it’s still using 4.0.4829 and so I’m still getting the “Could not load type…” issue related to Microsoft.Azure.WebJobs V 3.0.34.0

How can I remove 4.0.4829 and make VS use the latest Core Tools version?

Apologies for the inconvenience. Please note new packages should not impact any existing applications in Azure. Dependencies have been rolled out. Azure Functions Core Tools - https://github.com/Azure/azure-functions-core-tools will be updated soon.

Using latest Core Tools should allow users to upgrade to latest nuget packages.

Same problems as above for me. Azure function ran successfully when launched from command line (outside of VS) using func host start but failed with the same error Could not load type 'Microsoft.Azure.WebJobs.ParameterBindingData when launch from VS (either F5 debug, or without debugging).

Wasted almost a day trying lots of the fixes above, and ultimately came down to the version of Visual Studio vs the version of Azure Functions Core Tools.

Had installed latest Azure Functions Core Tools (v4.0.5198) and see that version confirmed in the command line approach - startup sequence.

While I was getting the error when launching from VS, I used sysinternals process monitor to see that VS was launching dotnet pointed at the func.dll at %localappdata%\AzureFunctionsTools\Releases\4.40.0\cli_x64\func.dll (OK, weird). AND, that DLL has version that’s BACK A FEW MINOR points v4.0.3971.0 which matches the output I see when that func host starts up in the command line as launched by VS (then followed by errors).

image

So – how / where / why is VS using this version of func.dll that is causing pain and suffering?

I also noticed compared to others in this thread, my VS doesn’t have Azure Functions node in Tools | Options…

image

Ultimately, THE FIX: Updated Visual Studio!

  • From: VS 2022 17.2.6
  • To: VS 2022 17.6.4

Now I can successfully run the function from VS, both F5 debug and without debugging. Not a single change to the code or references.

Hopefully all this info helps somebody else that’s in pain.

/cc @fabiocav

It’s unclear to me how things got into the AppData folder, and if that is even the “correct” place. I ended up (I think) deleting every azure* nuget, removing core tools anyway i could, then install them from the VS options > environment “Check for Updates” button.

I think various nugets might be installing the wrong version of core tools? I have no clue. At this point that’s the only way it could have been installed, as I added back other azure* nugets.

It’s maddening that it looks like the problem was encountered, and then the best fix was to implement a button that wasn’t capable of detecting the problem in VS. This is like a full workday spent on this.

One of the issues in my opinion is that there is multiple ways to install it, Visual Studio, VS Code or MSI. If a combination of mechanisms is used, then even if one is upgraded and things get out of sync, environments become brittle and stop working. The team should try and standardize in the installs or find a mechanism that would allow all installs to detect what a healthy environment should be and clean other installs.

Regards

Fabian Valencia Information Technology William Blair The William Blair Building | 150 North Riverside Plaza, Chicago, Illinois 60606 Direct: +1-312-364-5132 @.@.> | williamblair.comhttp://www.williamblair.com/ Facebookhttps://www.facebook.com/WilliamBlairCo/ | LinkedInhttps://www.linkedin.com/company/166939 | YouTubehttps://www.youtube.com/channel/UC7CPnCaTlZcLxOF7WFwY0uw | Twitterhttps://twitter.com/WilliamBlair

From: Fabio Cavalcante @.> Sent: Wednesday, June 21, 2023 6:35 PM To: Azure/azure-sdk-for-net @.> Cc: Valencia, Fabian @.>; Comment @.> Subject: Re: [Azure/azure-sdk-for-net] [BUG] Function App crashes on startup with error “Could not load type ‘Microsoft.Azure.WebJobs.ParameterBindingData’” (Issue #34467)

[EXTERNAL]

Yeah, apologies for the issue. Can you detail how you were testing/debugging? That will help us understand what tooling failed to update your environment. If this was an F5 debug failure from VS, that indicates VS had not downloaded the latest Core Tools version, otherwise (e.g., you were running func), it would be helpful to understand how you’ve installed Core Tools on your machine.

Thanks for the details, this helps!

— Reply to this email directly, view it on GitHubhttps://github.com/Azure/azure-sdk-for-net/issues/34467#issuecomment-1601822370, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AQZG2MZCZZOS4HQTNESPGYTXMOAL7ANCNFSM6AAAAAAVEDV4IA. You are receiving this because you commented.Message ID: @.@.>>

  • first I uninstalled all core tools (installed from msi and npm) to make sure only the one under AppData was available
  • then I shutdown my Visual Studio 2022
  • renamed AppData\Local\AzureFunctionsTools to AppData\Local_AzureFunctionTools (just in case I needed to restore it)
  • opened Visual Studio again
  • Used the check update in VS as mentioned in https://github.com/Azure/azure-sdk-for-net/issues/34467#issuecomment-1496026290 and then installed the updates
  • Voilá, the correct version (.5095) was installed!

Thanks VMM-TG! Your outlined processed is what worked for me. Getting the core tools updated and getting VS to pick up the latest version was the key to getting past this error. None of the other solutions were working for me.

Hi, I suppose I have the same issue: image The difference is that I’m using Visual Studio Code and trying to launch python functions. I have no idea on what to do, any help will be appreciated 😃

Hi,

just ran into this problem. My workaround:

  • first I uninstalled all core tools (installed from msi and npm) to make sure only the one under AppData was available
  • then I shutdown my Visual Studio 2022
  • renamed AppData\Local\AzureFunctionsTools to AppData\Local_AzureFunctionTools (just in case I needed to restore it)
  • opened Visual Studio again
  • Used the check update in VS as mentioned in eberthold’s comment and then installed the updates
  • Voilá, the correct version (.5095) was installed!

Thank you… Following these steps resolved the issue for me. 😃

Hi, I’ve downgraded Microsoft.Azure.WebJobs.Extensions.Storage 5.1.0 to 5.0.1, clean the project and it worked for me.

Hi, I’ve got the same problem described above. I tried to solve this by downgrading the package but the problem was not solved.

Any other advice?

Below are the package installed in my project:

image