Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Azure Functions - Could not load file or assembly 'System.Memory.Data, Version=6.0.0.0 #10575

Open
jsquire opened this issue Oct 12, 2024 · 18 comments · May be fixed by #10610
Open

Azure Functions - Could not load file or assembly 'System.Memory.Data, Version=6.0.0.0 #10575

jsquire opened this issue Oct 12, 2024 · 18 comments · May be fixed by #10610
Assignees

Comments

@jsquire
Copy link
Member

jsquire commented Oct 12, 2024

Issue Transfer

This issue has been transferred from the Azure SDK for .NET repository, #46577.

Please be aware that @fhtino is the author of the original issue and include them for any questions or replies.

Details

Library name and version

Azure.Data.Tables 12.9.1 and Azure.Storage.Blobs 12.22.2

Describe the bug

Cannot use Azure.Data.Tables and Azure.Storage.Blobs in the same Azure Functions project in VS 2022. When I use the TableClient I get

System.IO.FileNotFoundException: Could not load file or assembly 'System.Memory.Data, Version=6.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the file specified.
File name: 'System.Memory.Data, Version=6.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'
   at Azure.Core.RequestContent.Create(Object serializable, ObjectSerializer serializer)
   at Azure.Core.RequestContent.Create(Object serializable)
   at Azure.Data.Tables.TableClient.CreateIfNotExistsAsync(CancellationToken cancellationToken)
   at azfunct1.HelloWorld.Run(HttpRequest req, ILogger log) in xxxxxxx\az-func-cannot-load-assembly\azfunct1\HelloWorld.cs:line 29
var tsc = new TableServiceClient("UseDevelopmentStorage=true");
var tabc = tsc.GetTableClient("zzztest1");
await tabc.CreateIfNotExistsAsync();

Sample project with the issue:
https://github.com/fhtino/publicissues/tree/main/az-func-cannot-load-assembly

Workaround: place _FunctionsSkipCleanOutput in the project file:

<PropertyGroup>
	<_FunctionsSkipCleanOutput>true</_FunctionsSkipCleanOutput>

Expected behavior

no errors

Actual behavior

Exception: System.Memory.Data, Version=6.0.0.0 not found

Reproduction Steps

sample here: https://github.com/fhtino/publicissues/tree/main/az-func-cannot-load-assembly

Environment

  • Visual Studio 2022 17.11.5
  • Azure Functions Core Tools / Core Tools Version: 4.0.6518 (64-bit) / Function Runtime Version: 4.35.4.23179
@nodeomega
Copy link

nodeomega commented Oct 14, 2024

Can confirm. Also facing this issue.

Workaround I have seems to be having System.Memory.Data 6.0.0 installed as a separate NuGet package, building the solution, and copying the System.Memory.Data.dll file to the bin subdirectory in the bin folder, at least in Debug. (I assume Release would be the same way).

Which leads to a folder structure like bin\Debug\net8.0\bin, where I had to copy the dll from bin\Debug\net8.0

For whatever reason, this dependency isn't getting copied to that bin subfolder.

Side effect: Any time I make a change to the Azure Function project and rebuild, the copied System.Memory.Data.dll file disappears, and the error pops up again.

@fhtino - FYI.

@Rudresh-Dongre-Contractor

Facing the same issue recently while trying to use Azure.Storage.Blobs

@Dave-DRX
Copy link

Having same issue with Microsoft.Azure.WebJobs.Extensions.Storage.Queues.

System.Private.CoreLib: Exception has been thrown by the target of an invocation. Microsoft.Azure.WebJobs.Extensions.Storage.Queues: Could not load file or assembly 'System.Memory.Data, Version=6.0.0.0, Culture=neutral. The system cannot find the file specified.

@bishwaranjans
Copy link

I am also facing the same issue

@Dave-DRX
Copy link

The prescribed workaround (see above: "<_FunctionsSkipCleanOutput>true</_FunctionsSkipCleanOutput>") worked.
I guess I need to update to an isolated process, as recommended by Microsoft, sooner than I thought.

@sonofsmog
Copy link

Same issue with using Azure.Security.KeyVault.Secrets and callingSecretClient.GetSecretAsync. @nodeomega's workaround worked for me. Good looking out. Hopefully this gets fixed soon.

@mcremer-able
Copy link

Wer are using nodejs and as such can not use @nodeomega 's workaround.
Is there any way to maybe downgrade, so it can work again?

@shibayan
Copy link

Alternative workaround

  <ItemGroup>
    <FunctionsPreservedDependencies Include="System.Memory.Data.dll" />
  </ItemGroup>

@ZmorzynskiK

This comment has been minimized.

@Y-Sindo
Copy link
Member

Y-Sindo commented Oct 28, 2024

Having the same issue for the latest Microsoft.Azure.Functions.Worker.Extensions.SignalRService 1.15.0 version. It blocks users from using managed identity to connect to SignalR Service.

@DavidKoolen
Copy link

We have the same issue with Microsoft.Azure.Functions.Worker.Extensions.SignalRService 1.15.0. Downgrade to 1.14.1 resolves the issue and we can use the System-assigned managed identity again.

@sastru
Copy link

sastru commented Oct 28, 2024

Alternative workaround

<ItemGroup>
 <FunctionsPreservedDependencies Include="System.Memory.Data.dll" />
</ItemGroup>

I can confirm that this alone as the single change, made it work as expected.

@fabiocav fabiocav transferred this issue from Azure/azure-functions-dotnet-worker Oct 29, 2024
@stasaristic
Copy link

We have the same issue with Microsoft.Azure.Functions.Worker.Extensions.SignalRService 1.15.0. Downgrade to 1.14.1 resolves the issue and we can use the System-assigned managed identity again.

Had the same issue, this is the only thing that solved it. Unfortunately version 1.15.0 kept giving me: Microsoft.Azure.WebJobs.Extensions.EventHubs: Could not load file or assembly 'System.Memory.Data, Version=6.0.0.0, Culture=neutral'. The system cannot find the file specified.

@Y-Sindo
Copy link
Member

Y-Sindo commented Oct 30, 2024

Hi @jsquire , the workarounds that add some properties in the project file still don't work for Microsoft.Azure.Functions.Worker.Extensions.SignalRService 1.15.0.

The not working workarounds include:

  • <_FunctionsSkipCleanOutput>true</_FunctionsSkipCleanOutput>
  • <FunctionsPreservedDependencies Include="System.Memory.Data.dll" />

If you need any other information from me, please let me know.

@Arash-Sabet
Copy link

Arash-Sabet commented Oct 31, 2024

<ItemGroup>
 <FunctionsPreservedDependencies Include="System.Memory.Data.dll" />
</ItemGroup>

This workaround did not work. We need a permanent solution. This issue must be addressed ASAP as it's a roadblock.

@jameseedi
Copy link

I spent a significant amount of time resolving an issue involving dependencies on System.Memory.Data 6.0.0. Locally, I managed to get things working by manually replacing the DLL with version 6.0.0 in the AzureFunctionsTools folder at:

C:\Users\User\AppData\Local\AzureFunctionsTools\Releases\4.100.0\cli_x64

However, on Azure, this isn't possible due to the lack of access for patching DLLs directly. After extensive troubleshooting, I discovered that the recent upgrade to Microsoft.Azure.Functions.Worker.Extensions.SignalRService 1.15.0 was the root cause. Downgrading to 1.14.1 resolved the issue.

This complex dependency setup clearly needs addressing. Ideally, we should also have more control over configuration in Azure to facilitate such troubleshooting. If there are any ways to achieve this, please let me know.

Having used Azure Functions since v1, I’ve found it to be a convenient but often frustrating service. The migration paths (e.g., isolated functions, v1 to v2) have been rocky, and these issues make maintaining reliable services challenging. I encourage proactive measures to improve stability in the Azure Functions ecosystem. 🙏

@pingu2k4
Copy link

pingu2k4 commented Nov 6, 2024

I've got the same issue here regarding the SignalRService package. None of the workarounds fix anything in this instance, other than reverting to 1.14.1, including things I had tried from other places (for example using assembly binding redirects)

Would love to see a resolution for this.

@fabiocav
Copy link
Member

fabiocav commented Nov 7, 2024

The current mitigation is to apply update the project configuration mentioned in the issue if using the .NET in-proc model:

<ItemGroup>
    <FunctionsPreservedDependencies Include="System.Memory.Data.dll" />
</ItemGroup>

For the .NET Isolated model, the impacted package (SignalR) must be downgraded. We will work with the appropriate team to delist in the meantime, as this was an invalid update. We'll also be working with them to ensure this issue is prevented in the future.

A fix for this will be rolling out with the next host deployment. Thank you all for the report and patience.

@fabiocav fabiocav self-assigned this Nov 7, 2024
@fabiocav fabiocav linked a pull request Nov 7, 2024 that will close this issue
9 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.