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

Could not load file or assembly System.Memory Version=4.0.1.0 #1507

Open
2 of 8 tasks
weberms opened this issue Jan 23, 2021 · 7 comments
Open
2 of 8 tasks

Could not load file or assembly System.Memory Version=4.0.1.0 #1507

weberms opened this issue Jan 23, 2021 · 7 comments

Comments

@weberms
Copy link

weberms commented Jan 23, 2021

Description

File load exception when using Confluent.Kafka 1.5.3 with SystemText.Json 5.0.1

Could not load file or assembly 'System.Memory, Version=4.0.1.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

How to reproduce

Add Confluent.Kafka and System.Text.Json from Nuget. Try to consume events from Kafka queue. Error is thrown when ConsumerBuilder.Build is called to create IClient instance. .NET Framework 4.7.1 project.

Checklist

Please provide the following information:

  • A complete (i.e. we can run it), minimal program demonstrating the problem. No need to supply a project file.
  • Confluent.Kafka nuget version.
  • Apache Kafka version.
  • Client configuration.
  • Operating system.
  • Provide logs (with "debug" : "..." as necessary in configuration).
  • Provide broker log excerpts.
  • Critical issue.
@andrewfinnell
Copy link

Do we have an update or work around for this issue? This is quite critical for us as well. We'd rather not have to downgrade our System.Memory assembly as that seems to be the only fix.

@mrt181
Copy link

mrt181 commented May 6, 2021

This still happens with version 1.6.3 and I had to roll back to version 1.5.2.
I have to use net472 because of a third party library from some vendor.

@wensaint
Copy link

wensaint commented Jun 2, 2021

i have the same issue, so i roll back to v1.5

@mrt181
Copy link

mrt181 commented Jul 1, 2021

v1.7.0 works with net472 for me

@weberms
Copy link
Author

weberms commented Oct 27, 2021

@mhowlett this is still happening with the latest v1.8.2 of the client. Is a fix coming?

@gseddon
Copy link

gseddon commented Nov 4, 2021

I was able to work around it (with the latest Kafka installed) by adding this to the <runtime> section of my app.config:

    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
	  <dependentAssembly>
		<assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral"/>
		<bindingRedirect oldVersion="0.0.0.0-4.5.4.0" newVersion="4.0.1.1"/>
	  </dependentAssembly>
    </assemblyBinding>

@inikulshin
Copy link

inikulshin commented May 17, 2023

I think, this issue (and probably also #1184) is caused by 14e0d0e, <SignAssembly>true</SignAssembly> build option.

Maybe, adding <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects> will help, as suggested workaround by @gseddon will be automatic. Also, see I really, really need to strong-name, what kinds of issues will I run into?

Update: or <GenerateBindingRedirectsOutputType>true</GenerateBindingRedirectsOutputType>?

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

No branches or pull requests

6 participants