'Could not find file Microsoft.AspNetCore.WebUtilities.FileBufferingReadStream

I'm running an Azure Function locally in Visual Studio but receive the error "Could not find file 'C:\Users\kbiondi\AppData\Local\AzureFunctionsTools\Releases\4.13.0\cli_x64\Microsoft.AspNetCore.WebUtilities.FileBufferingReadStream'. (details below).

The code that triggers this error seems to be: let! parameters = JsonTypeProvider.AsyncLoad(req.Body.ToString())

Using let parameters = JsonTypeProvider.Load(req.Body) the function runs without problem.

I have reloaded various nuget packages and the sdk, but this problem persists.

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

[2022-05-19T18:24:10.578Z] Csproj not found in C:\Users\kbiondi\OneDrive - CalPERS\Repos\AzFunction_BpipeRefData\bin\Debug\net6.0 directory tree. Skipping user secrets file configuration.

Functions:

    BpipeReferenceDataRequest: [GET,POST] http://localhost:7071/api/BpipeReferenceDataRequest

For detailed output, run func with --verbose flag. [2022-05-19T18:24:16.773Z] Host lock lease acquired by instance ID '0000000000000000000000001F77FD18'. [2022-05-19T18:24:43.597Z] Executing 'BpipeReferenceDataRequest' (Reason='This function was programmatically called via the host APIs.', Id=13a1beaf-3141-4112-a086) The Azure Function Received a Request... Request failed with the following error:

Message: Could not find file 'C:\Users\kbiondi\AppData\Local\AzureFunctionsTools\Releases\4.13.0\cli_x64\Microsoft.AspNetCore.WebUtilities.FileBufferingReadStream'.

Source: System.Private.CoreLib

TargetSite: Microsoft.Win32.SafeHandles.SafeFileHandle CreateFile(System.String, System.IO.FileMode, System.IO.FileAccess, System.IO.FileShare, System.IO.FileOptions)

StackTrace: at Microsoft.Win32.SafeHandles.SafeFileHandle.CreateFile(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options) at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize) at System.IO.Strategies.OSFileStreamStrategy..ctor(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize) at [email protected](Unit unitVar) at Microsoft.FSharp.Control.AsyncPrimitives.CallThenInvoke[T,TResult](AsyncActivation1 ctxt, TResult result1, FSharpFunc2 part2) in D:\a_work\1\s\src\fsharp\FSharp.Core\async.fs:line 447 at BpipeProcess.BpipeReferenceDataRequest.Pipe #1 input at line [email protected](AsyncActivation1 ctxt) at BpipeProcess.BpipeReferenceDataRequest.Pipe #1 input at line [email protected](AsyncActivation1 ctxt) at Microsoft.FSharp.Control.Trampoline.Execute(FSharpFunc`2 firstAction) in D:\a_work\1\s\src\fsharp\FSharp.Core\async.fs:line 104[2022-05-19T18:24:43.679Z] Executed 'BpipeReferenceDataRequest' (Succeeded, Id=13a1beaf-3141-4112-a086, Duration=101ms)



Solution 1:[1]

Based on the MICROSOFT DOCUMENTATION:-

F# script (.fsx) is only supported by version 1.x of the Azure Functions runtime. If you want to use F# with version 2.x and later versions of the runtime, you must use a precompiled F# class library project (.fs). You create, manage, and publish an F# class library project using Visual Studio .

You can use in that line if wants http request e.g:- let Run(req: HttpRequestMessage, log: ILogger) =

And make sure that your folder structure looks like below format:

FunctionsProject
 | - MyFirstFunction
 | | - run.fsx
 | | - function.json
 | | - function.proj
 | - MySecondFunction
 | | - run.fsx
 | | - function.json
 | | - function.proj
 | - host.json
 | - extensions.csproj
 | - bin

For more information please refer the aforementioned and below links:

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 AjayKumarGhose-MT