StackExchange.Redis icon indicating copy to clipboard operation
StackExchange.Redis copied to clipboard

The assembly for System.Runtime.CompilerServices.Unsafe could not be loaded in netcore2.1

Open KillingMeNow opened this issue 5 years ago • 6 comments

Got this error in netcore2.1 webapi,im using StackExchange.Redis 2.2.4(also tried downgrade to 2.0.513 but still got this),it only happens in my server,Windows Server2016.

[10:58:49.833 Error] The assembly for System.Runtime.CompilerServices.Unsafe could not be loaded; this usually means a missing assembly binding redirect - try checking this, and adding any that are missing; note that it is not always possible to add this redirects - for example 'azure functions v1'; it looks like you may need to use 'azure functions v2' for that - sorry, but that's out of our control at Pipelines.Sockets.Unofficial.Internal.Throw.InvalidOperation(String message) in //src/Pipelines.Sockets.Unofficial/Internal/Throw.cs:line 16 at StackExchange.Redis.ConnectionMultiplexer.Connect(ConfigurationOptions configuration, TextWriter log) in //src/StackExchange.Redis/ConnectionMultiplexer.cs:line 1025

KillingMeNow avatar Jan 18 '21 03:01 KillingMeNow

I got the same issue after upgrading to the latest version, but 2.0.519 still works well for me

nhathongly avatar Feb 05 '21 03:02 nhathongly

Facing the same issue, pls some one help, we are using stack exchange redis in our production system and is causing issue.

ghost avatar Feb 24 '21 06:02 ghost

We are using aws redis

ghost avatar Feb 24 '21 06:02 ghost

I have down grade to nuget stackexchange 1.6 ,and it's ok

kobewang avatar Feb 25 '21 12:02 kobewang

I'm on .net core 2.2 and just updated to StackExchange.Redis v2.2.4. I was getting the same issue and then I resolved it by adding the latest stable System.Runtime.CompilerServices.Unsafe v5.0.0. Hope that helps someone ✌️

jefflafay avatar Mar 16 '21 20:03 jefflafay

You can find info about this issue here: https://nickcraver.com/blog/2020/02/11/binding-redirects/ - I wrote a blog post because we had so many duplicate asks about this across many libraries (I agree, it's not intuitive). Closing this one out for the same duplicate reason :)

NickCraver avatar Apr 04 '21 18:04 NickCraver