简体   繁体   English

IdentityModel 因“无法加载文件或程序集‘System.Numerics.Vectors,Version=4.1.4.0’”而中断

[英]IdentityModel breaks with "Could not load file or assembly 'System.Numerics.Vectors, Version=4.1.4.0"

We have a .NET Framework 4.7.1 project我们有一个 .NET Framework 4.7.1 项目

I installed IdentityModel 6.0.0 with the NuGet Package Manager.我使用 NuGet Package 管理器安装了 IdentityModel 6.0.0。 It installed the following dependencies for me:它为我安装了以下依赖项:

Microsoft.Bcl.AsyncInterfaces 6.0.0
System.Buffers 4.5.1
System.Memory 4.5.4
System.Numerics.Vectors 4.5.0
System.Text.Json 6.0.3
System.ValueTuple 4.5.0

I'm trying to run the following code to see if a service exists:我正在尝试运行以下代码以查看服务是否存在:

var disco = await clientAuth.GetDiscoveryDocumentAsync(new DiscoveryDocumentRequest
{
    Address = server,
    Policy =
    {
        ValidateIssuerName = false
    }
});
if (disco.IsError) {...}

But, it keeps generating an error.但是,它不断产生错误。 I managed to drill down into the code, and finally came upon this: var result = System.Text.Json.JsonDocument.Parse("{"issuer":"https:....}").RootElement;我设法深入研究了代码,最后发现了这个: var result = System.Text.Json.JsonDocument.Parse("{"issuer":"https:....}").RootElement;

The error I get on this is:我得到的错误是:

Could not load file or assembly 'System.Numerics.Vectors, Version=4.1.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.

at System.Text.Json.JsonReaderHelper.IndexOfOrLessThan(Byte& searchSpace, Byte value0, Byte value1, Byte lessThan, Int32 length) in /_/src/libraries/System.Text.Json/src/System/Text/Json/Reader/JsonReaderHelper.cs:line 208

at System.Text.Json.Utf8JsonReader.ConsumeString() in /_/src/libraries/System.Text.Json/src/System/Text/Json/Reader/Utf8JsonReader.cs:line 1276

at System.Text.Json.Utf8JsonReader.ConsumePropertyName() in /_/src/libraries/System.Text.Json/src/System/Text/Json/Reader/Utf8JsonReader.cs:line 1227

at System.Text.Json.Utf8JsonReader.ReadSingleSegment() in /_/src/libraries/System.Text.Json/src/System/Text/Json/Reader/Utf8JsonReader.cs:line 852

at System.Text.Json.Utf8JsonReader.Read() in /_/src/libraries/System.Text.Json/src/System/Text/Json/Reader/Utf8JsonReader.cs:line 272

at System.Text.Json.JsonDocument.Parse(ReadOnlySpan`1 utf8JsonSpan, JsonReaderOptions readerOptions, MetadataDb& database, StackRowStack& stack) in /_/src/libraries/System.Text.Json/src/System/Text/Json/Document/JsonDocument.cs:line 1092

at System.Text.Json.JsonDocument.Parse(ReadOnlyMemory`1 utf8Json, JsonReaderOptions readerOptions, Byte[] extraRentedArrayPoolBytes, PooledByteBufferWriter extraPooledByteBufferWriter) in /_/src/libraries/System.Text.Json/src/System/Text/Json/Document/JsonDocument.Parse.cs:line 697

at System.Text.Json.JsonDocument.Parse(ReadOnlyMemory`1 json, JsonDocumentOptions options) in /_/src/libraries/System.Text.Json/src/System/Text/Json/Document/JsonDocument.Parse.cs:line 271

at System.Text.Json.JsonDocument.Parse(String json, JsonDocumentOptions options) in /_/src/libraries/System.Text.Json/src/System/Text/Json/Document/JsonDocument.Parse.cs:line 316

at Citadel.Framework.APICalls.APIBase.<Setup>d__3.MoveNext() in C:\Dev\Src\Tyrus\Production\Tyrus_5_1\Citadel.Framework.APICalls\APIBase.cs:line 86

I managed to drill down to the ConsumeString method, but couldn't learn anything.我设法深入到 ConsumeString 方法,但无法学到任何东西。

The most annoying of all is I can't load version 4.1.4 for System.Numerics.Vectors最烦人的是我无法为 System.Numerics.Vectors 加载版本 4.1.4

In the Nuget Manager, only the following versions are available:在Nuget Manager中,只有以下版本可用:

4.5.0 - current
4.4.0
4.3.0
4.1.1
4.1.0
4.0.0

I'm getting preciously little on the inte.net regarding this specific issue, and I've tried everything I could find without any luck.关于这个特定问题,我在 inte.net 上得到的信息很少,而且我已经尝试了所有我能找到的东西,但没有任何运气。 I've tried clearing my nuget cache.我试过清除我的 nuget 缓存。 I can't remember how many times I've removed and readded the dependencies, I've cleaned my solution and rebuild it.我不记得我删除并重新添加了多少次依赖项,清理了我的解决方案并重建了它。 I tried a number of combinations of:我尝试了多种组合:

<dependentAssembly>
    <assemblyIdentity name="System.Numerics.Vectors" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
    <bindingRedirect oldVersion="0.0.0.0-4.5.0.0" newVersion="4.1.4.0" />
</dependentAssembly>

Turns out that adding the following line in your root project file will magically make all the problems go away:事实证明,在您的根项目文件中添加以下行将神奇地解决所有问题 go:

<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>

Odd that I didn't find any article suggesting this.奇怪的是我没有找到任何暗示这一点的文章。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 无法加载文件或程序集“System.Numerics.Vectors - Could not load file or assembly 'System.Numerics.Vectors 在 Godot C# android 构建中使用 System.Text.Json 时无法加载文件或程序集“System.Numerics.Vectors” - Could not load file or assembly 'System.Numerics.Vectors' when using System.Text.Json in Godot C# android build VS Code Omnisharp.MsBuild.Projectmanager 无法加载程序集 System.Numerics.Vectors 4.1.3.0 - VS Code Omnisharp.MsBuild.Projectmanager can not load assembly System.Numerics.Vectors 4.1.3.0 System.Numerics.Vectors和Windows 7-不起作用 - System.Numerics.Vectors and Windows 7 - does not work 通过NuGet安装System.Numerics.Vectors - Installing System.Numerics.Vectors via NuGet System.Numerics.Vectors IsHardwareAccelerated返回false - System.Numerics.Vectors IsHardwareAccelerated returns false 使用System.Numerics.Vectors旋转2D点 - Rotate 2D points using System.Numerics.Vectors 无法加载文件或程序集系统2.0.0版 - Could not load file or assembly System, Version 2.0.0 无法加载文件或程序集“System.IdentityModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089”或其依赖项之一 - Could not load file or assembly 'System.IdentityModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies 为什么 System.Memory 依赖于 System.Numerics.Vectors in.Net 4.6.1 而不是 in.Net 4.6? - Why does System.Memory have a dependency on System.Numerics.Vectors in .Net 4.6.1 but not in .Net 4.6?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM