azure-webjobs-sdk: WebJobs v3 does not run in a .NET 4.6.1 console app

Scenario:

  1. Create a .NET 4.6.1 console app
  2. Add the WebJobs v3 package
  3. Create a simple app with just a single function (I created a QueueTrigger)
  4. Run
  5. End up with the error here: https://github.com/Azure/azure-webjobs-sdk/issues/1385#issuecomment-355139760

LoaderExceptions are: Method 'Commit' in type 'Microsoft.Azure.WebJobs.Host.Blobs.Bindings.DelegatingCloudBlobStream' from assembly 'Microsoft.Azure.WebJobs.Host, Version=3.0.0.0, Culture=neutral, PublicKeyToken=null' does not have an implementation.

The issue is that WindowsAzure.Storage ships two different libraries – one for netstandard13 (which WebJobs v3 builds against) and one for net45 (which a .NET 4.6.1 app will run against). Those two libraries have two different versions of CloudBlobStream, which we derive from in DelegatingCloudBlobStream. The most obvious change is that it has a Commit method in net45 and a CommitAsync in netstandard13.

Talked with @fabiocav and there’s no obvious easy workaround or solution right now. Customers will either need to use WebJobs v2 if they target .NET 4.6.1 or use a .NET Core console app if they want to use v3.

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 6
  • Comments: 16 (10 by maintainers)

Most upvoted comments

I can confirm the workaround suggested by @brettsam.

@garyapps To target the netstandard1.3 version I needed to unload the project in Visual Studio, edit the csproj file and changed the corresponding hint path for the referenced dependency from

<Reference Include="Microsoft.WindowsAzure.Storage, Version=9.3.2.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> 
  
  <HintPath>..\packages\WindowsAzure.Storage.9.3.2\lib\net45\Microsoft.WindowsAzure.Storage.dll</HintPath>
</Reference>

to

<Reference Include="Microsoft.WindowsAzure.Storage, Version=9.3.2.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> 
  
  <HintPath>..\packages\WindowsAzure.Storage.9.3.2\lib\netstandard1.3\Microsoft.WindowsAzure.Storage.dll</HintPath>
</Reference>

@davidmatson I’m in the same boat (using 4.7.2). I ended up, temporarily, excluding the remote asset and adding the 1.3 local version. .Csproj looks like this:

    <PackageReference Include="WindowsAzure.Storage" Version="9.3.1">
    <ExcludeAssets>All</ExcludeAssets>
    </PackageReference>
    </ItemGroup>
    <ItemGroup>
    <Reference Include="WindowsAzure.Storage" Version="9.3.1">
    <Hintpath>ExternalPackages\Microsoft.WindowsAzure.Storage.dll</HintPath>
    </Refence>
    </ItemGroup>```

Hopefully there is different way to do it with PackageReference but I had no luck.

Heya, yeah I did mean the WebJobs package.

In any case I’ve been running the QueueTrigger webjob in Azure on Net 4.7.2 for a few days without a hiccough or crash, so I think I’ll bite with the preview version and see it through.

I believe there is something that can be done from the WebJobs side - it could ship both lib\net45 (or some other min version) and lib\netstandard2.0 DLLs. That might be the only solution that guarantees this kind of bug doesn’t happen again - if any dependencies have a .NET Framework version that isn’t fully binary-compatible with their .NET Standard version, we’d probably have the same problem here.

Do you mean the WebJobs package? https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Extensions.Storage/4.0.0-preview1

I don’t have any concrete changes – but this is such a huge change in the Storage SDK that I suspect these types have all been reworked.

@brettsam I was running into this issue, however after installing the 4.0 beta for Microsoft.Azure.Storage, the warnings have went away. I scanned the release notes but nothing stood out and this issue wasn’t referenced. Are you aware of any fixes therein that might have alleviated this?

I have run into this same issue; I tried to use version 3.0 of the webjobs SDK in a .net framework webjob (which is what the VS template for a webjob produces), and just cannot get it to run on Azure.

@brettsam I don’t know how to implement your workaround. How does one change the reference to target a different version of the library? When I look on NuGet for WindowsAzure.Storage I only see one version. Is there someplace I can obtain this netstandard1.3 version you mentioned? Or did you mean something else?

@fabiocav Is there an estimate for when this issue will be resolved? It has been 8 months since you brought it to the attention of the storage team so it might have slipped through the cracks.