The assembly for System.Buffers could not be loaded;无法加载System.Buffers的程序集
調(diào)用Redis類(lèi)庫(kù):?StackExchange/StackExchange.Redis? 進(jìn)行Redis連接時(shí),有時(shí)會(huì)發(fā)生:
如下錯(cuò)誤:
英文:
The assembly for System.Buffers 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
中文:
無(wú)法加載System.Buffers的程序集;這通常意味著缺少程序集綁定重定向-請(qǐng)嘗試檢查此重定向,并添加任何缺少的重定向;請(qǐng)注意,并不總是可以添加此重定向-例如“Azure函數(shù)v1”;看起來(lái)您可能需要使用“Azure函數(shù)v2”進(jìn)行重定向-抱歉,但這已超出您的權(quán)限。
?
原因分析:
參考鏈接:https://github.com/dotnet/corefx/issues/32511
?
Pipelines.Sockets.Unofficial 類(lèi)庫(kù),依賴(lài)與:
System.IO.Pipelines (>= 4.5.1)?
System.Buffers (>= 4.4.0)?
?
?而System.IO.Pipelines(4.5.1)版本依賴(lài)于?
NETStandard.Library (>= 1.6.1)
System.Memory (>= 4.5.1)
System.Buffers (>= 4.4.0)?
System.Threading.Tasks.Extensions (>= 4.5.1)
?
?而System.IO.Pipelines(4.5.3)版本依賴(lài)于
?System.Memory (>= 4.5.1)
?System.Buffers (>= 4.4.0)?
?
如果系統(tǒng)里面引用的System.IO.Pipelines 和 System.Buffers 文件版本,低于要求:?System.IO.Pipelines (>= 4.5.1)? 、 System.Buffers (>= 4.4.0)? 時(shí),就會(huì)發(fā)生上述依賴(lài)報(bào)錯(cuò)問(wèn)題。
?
?
解決方法:
?
1.查找所有項(xiàng)目引用,更新類(lèi)庫(kù)Pipelines.Sockets.Unofficial 到最新版本(當(dāng)前是 v2.0.22)
2.查找所有項(xiàng)目引用,更新?System.IO.Pipelines 類(lèi)庫(kù)版本,版本至少要 >= 4.5.1,最好是 >= 4.5.2,這樣只會(huì)引用?System.Memory (>= 4.5.1)、??System.Buffers (>= 4.4.0) 兩個(gè)文件,而4.5.1版本需要引用4個(gè)文件
3.查找所有項(xiàng)目引用,更新 System.Buffers 類(lèi)庫(kù)版本,版本至少要 >= 4.4.0
如果連接時(shí)出現(xiàn)如下異常 :
未能加載文件或程序集“System.IO.Pipelines, Version=4.0.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51”或它的某一個(gè)依賴(lài)項(xiàng)。系統(tǒng)找不到指定的文件。
說(shuō)明bin目錄下沒(méi)有System.IO.Pipelines文件,此時(shí)可以在啟動(dòng)項(xiàng)目.exe項(xiàng)目下,添加對(duì)System.IO.Pipelines(版本至少要 >= 4.5.1)的引用,并設(shè)置為復(fù)制到輸出目錄
?如果引用的是 System.IO.Pipelines ( v4.5.1)? 且引用了?System.Threading.Tasks.Extensions (版本低于4.5.2),也會(huì)報(bào)錯(cuò),因?yàn)镾ystem.IO.Pipelines ( v4.5.1) 需要引用?System.Threading.Tasks.Extensions (>= 4.5.2)
參考鏈接:
https://github.com/dotnet/corefx/issues/32511
https://github.com/dotnet/corefx/issues/32457
?
轉(zhuǎn)載于:https://www.cnblogs.com/xytmj/p/11075510.html
總結(jié)
以上是生活随笔為你收集整理的The assembly for System.Buffers could not be loaded;无法加载System.Buffers的程序集的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: webpack 3.1 升级webpac
- 下一篇: 这应该是脑结构、脑工作原理最详细的图解了