Azure / azure-functions-durable-extension

Durable Task Framework extension for Azure Functions
MIT License
713 stars 268 forks source link

C# Orchestration template will compile but fails to run #2229

Closed Jawz84 closed 2 years ago

Jawz84 commented 2 years ago

Description

I want to run the Durable functions Orchestration template. It compiles, but func host start results in an error:

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')

Expected behavior

I would have expected the template to build and run.

Actual behavior

image I have tried this on two separate computers. Same behaviour. I have also tried to do this through the Visual Studio Code extension, but that results in the same behaviour as well (no surprise there).

I just found out from the README.md in this repo about this install step that I was not aware of: func extensions install -p Microsoft.Azure.WebJobs.Extensions.DurableTask -v 2.3.0 I have ran that just now, to see if that resolves my problem. It does not, but it does alter the error, which may be interesting:

image

I have just looked the package Microsoft.Azure.WebJobs.Extensions.DurableTask up on nuget, and latest version appears to be 2.7.2 instead of 2.3.0, so I installed that version with func extensions install -p Microsoft.Azure.WebJobs.Extensions.DurableTask -v 2.7.2

That brought the problem back to it's original 'signature': image

Known workarounds

None yet.

App Details

If deployed to Azure

Deploying to Azure fails: image

@davidmrdavid we had contact on Twitter earlier. Thank you for looking into this!

Jawz84 commented 2 years ago

Somewhat good news: I just spun up a brand new Azure VM with Windows 10, and installed dotnet 6.0.302, func 4.0.4629, spun up Azurite and was able to successfully use the template. So it's probably safe to say that it's my machines. I'm still puzzled why I get the exact same error on the two other devices. And what I need to do to fix these machines. I have tried dotnet nuget locals all --clear && dotnet clean -v m && dotnet restore without avail.

Jawz84 commented 2 years ago

Well. I have a bigger problem, and I've concluded it is not related to Durable functions. When I create a default HttpTrigger function and try to run that, same error occurs. I'm inclined to close this issue, remove all of dotnet and func and start over...

~\GitNoOneDrive> md testfunc && cd .\testfunc

    Directory: C:\Users\jkoelewijn\GitNoOneDrive

Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
d----           7/19/2022 11:56 AM                testfunc

~\GitNoOneDrive\testfunc> func new
Use the up/down arrow keys to select a worker runtime:dotnet
Use the up/down arrow keys to select a language:c#

Writing C:\Users\jkoelewijn\GitNoOneDrive\testfunc\.vscode\extensions.json
Use the up/down arrow keys to select a template:Function name: testfunc
testfunc

The function "testfunc" was created successfully from the "HttpTrigger" template.
~\GitNoOneDrive\testfunc> func host start
Microsoft (R) Build Engine version 17.2.0+41abc5629 for .NET
Copyright (C) Microsoft Corporation. All rights reserved.

  Determining projects to restore...
  Restored C:\Users\jkoelewijn\GitNoOneDrive\testfunc\testfunc.csproj (in 1.27 sec).
  testfunc -> C:\Users\jkoelewijn\GitNoOneDrive\testfunc\bin\output\testfunc.dll

Build succeeded.
    0 Warning(s)
    0 Error(s)

Time Elapsed 00:00:04.78

Azure Functions Core Tools
Core Tools Version:       4.0.4629 Commit hash: N/A  (64-bit)
Function Runtime Version: 4.6.1.18388

[2022-07-19T09:57:32.953Z] Found C:\Users\jkoelewijn\GitNoOneDrive\testfunc\testfunc.csproj. Using for user secrets file configuration.
[2022-07-19T09:57:33.982Z] A host error has occurred during startup operation 'e8df23e2-a9f3-47fb-998e-161613b42e50'.
[2022-07-19T09:57:33.983Z] 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')
~\GitNoOneDrive\testfunc>
Jawz84 commented 2 years ago

I was able to solve the problem by uninstalling ALL dotnet versions (including Visual Studio's), removing AzureFunctionsCoreTools, and doing a clean install of those. After that a dotnet clean -v m && dotnet restore && func host start Now it works sigh. @davidmrdavid thanks so much for your efforts!