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