VSCode Codeactions 不适用于 Apple M1
VSCode Codeactions not working on Apple M1
我创建了一个新的 Web-API 项目并使用 dotnet cli 引用了一个新创建的 class 库。这两个项目都包含在解决方案中。
我已经安装了 Apple Silicon 版本的 VSCode (1.64.2) 以及 arm64 Dotnet-Sdk (6.0.200)。
这是我使用过的命令:
dotnet new sln -n test
dotnet new webapi -n testapi
dotnet new classlib -n testlib
dotnet sln add testapi
dotnet sln add testlib
cd testapi
dotnet add reference ../testlib
当我尝试在 testapi
项目中使用自动导入 using 语句时,它显示 没有可用的代码操作 。当我在 testlib
项目中尝试相同时,它按预期工作。
在 Omnisharp 日志中,我看到以下错误:
[warn]: OmniSharp.Stdio.Host
************ Request ************
{
"Type": "request",
"Seq": 120,
"Command": "/v2/getcodeactions",
"Arguments": {
"FileName": "/Users/XXX/Projects/testapi/Program.cs",
"Line": 18,
"Column": 11
}
}
[fail]: OmniSharp.Stdio.Host
************ Response (43.8339ms) ************
{
"Request_seq": 120,
"Command": "/v2/getcodeactions",
"Running": true,
"Success": false,
"Message": "\"System.Reflection.ReflectionTypeLoadException: Exception of type 'System.Reflection.ReflectionTypeLoadException' was thrown.\nCould not load file or assembly 'Microsoft.CodeAnalysis, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies.\n at (wrapper managed-to-native) System.Reflection.Assembly.GetTypes(System.Reflection.Assembly,bool)\n at System.Reflection.Assembly.GetTypes () [0x00000] in <36514b14425c4337b446653c547aa9c3>:0 \n at System.Reflection.Assembly+<get_DefinedTypes>d__127.MoveNext () [0x0001e] in <36514b14425c4337b446653c547aa9c3>:0 \n at System.Linq.Enumerable+SelectManySingleSelectorIterator`2[TSource,TResult].MoveNext () [0x0006f] in <14c1495deda74532849f8ec10b438611>:0 \n at System.Linq.Enumerable+WhereSelectEnumerableIterator`2[TSource,TResult].MoveNext () [0x00059] in <14c1495deda74532849f8ec10b438611>:0 \n at System.Linq.Enumerable+WhereEnumerableIterator`1[TSource].MoveNext () [0x0004e] in <14c1495deda74532849f8ec10b438611>:0 \n at System.Collections.Generic.LargeArrayBuilder`1[T].AddRange (System.Collections.Generic.IEnumerable`1[T] items) [0x0003d] in <14c1495deda74532849f8ec10b438611>:0 \n at System.Collections.Generic.SparseArrayBuilder`1[T].AddRange (System.Collections.Generic.IEnumerable`1[T] items) [0x00000] in <14c1495deda74532849f8ec10b438611>:0 \n at System.Collections.Generic.SparseArrayBuilder`1[T].ReserveOrAdd (System.Collections.Generic.IEnumerable`1[T] items) [0x00017] in <14c1495deda74532849f8ec10b438611>:0 \n at System.Linq.Enumerable+Concat2Iterator`1[TSource].ToArray () [0x00015] in <14c1495deda74532849f8ec10b438611>:0 \n at System.Linq.Enumerable.ToArray[TSource] (System.Collections.Generic.IEnumerable`1[T] source) [0x0001f] in <14c1495deda74532849f8ec10b438611>:0 \n at System.Collections.Immutable.ImmutableArray.CreateRange[T] (System.Collections.Generic.IEnumerable`1[T] items) [0x0004d] in <be358f84962848a48784e4a9d001abe1>:0 \n at System.Collections.Immutable.ImmutableArray.ToImmutableArray[TSource] (System.Collections.Generic.IEnumerable`1[T] items) [0x0000f] in <be358f84962848a48784e4a9d001abe1>:0 \n at OmniSharp.Roslyn.CSharp.Services.Refactoring.V2.CachingCodeFixProviderForProjects.LoadFrom (Microsoft.CodeAnalysis.Project project) [0x000d5] in <7833e4dfb11c41969fc8bb341c494975>:0 \n at OmniSharp.Roslyn.CSharp.Services.Refactoring.V2.CachingCodeFixProviderForProjects.GetAllCodeFixesForProject (Microsoft.CodeAnalysis.ProjectId projectId) [0x00045] in <7833e4dfb11c41969fc8bb341c494975>:0 \n at OmniSharp.Roslyn.CSharp.Services.Refactoring.V2.BaseCodeActionService`2[TRequest,TResponse].GetSortedCodeFixProviders (Microsoft.CodeAnalysis.Document document) [0x00011] in <7833e4dfb11c41969fc8bb341c494975>:0 \n at OmniSharp.Roslyn.CSharp.Services.Refactoring.V2.BaseCodeActionService`2[TRequest,TResponse].AppendFixesAsync (Microsoft.CodeAnalysis.Document document, Microsoft.CodeAnalysis.Text.TextSpan span, System.Collections.Generic.IEnumerable`1[T] diagnostics, System.Collections.Generic.List`1[T] codeActions) [0x0003e] in <7833e4dfb11c41969fc8bb341c494975>:0 \n at OmniSharp.Roslyn.CSharp.Services.Refactoring.V2.BaseCodeActionService`2[TRequest,TResponse].CollectCodeFixesActions (Microsoft.CodeAnalysis.Document document, Microsoft.CodeAnalysis.Text.TextSpan span, System.Collections.Generic.List`1[T] codeActions) [0x001c1] in <7833e4dfb11c41969fc8bb341c494975>:0 \n at OmniSharp.Roslyn.CSharp.Services.Refactoring.V2.BaseCodeActionService`2[TRequest,TResponse].GetAvailableCodeActions (OmniSharp.Models.V2.CodeActions.ICodeActionRequest request) [0x001a4] in <7833e4dfb11c41969fc8bb341c494975>:0 \n at OmniSharp.Roslyn.CSharp.Services.Refactoring.V2.GetCodeActionsService.Handle (OmniSharp.Models.V2.CodeActions.GetCodeActionsRequest request) [0x0006b] in <7833e4dfb11c41969fc8bb341c494975>:0 \n at OmniSharp.Endpoint.EndpointHandler`2[TRequest,TResponse].GetFirstNotEmptyResponseFromHandlers (OmniSharp.Endpoint.Exports.ExportHandler`2[TRequest,TResponse][] handlers, TRequest request) [0x00099] in <5f96298298f74346ad96eb79547a94e4>:0 \n at OmniSharp.Endpoint.EndpointHandler`2[TRequest,TResponse].HandleRequestForLanguage (System.String language, TRequest request, OmniSharp.Protocol.RequestPacket packet) [0x00163] in <5f96298298f74346ad96eb79547a94e4>:0 \n at OmniSharp.Endpoint.EndpointHandler`2[TRequest,TResponse].Process (OmniSharp.Protocol.RequestPacket packet, OmniSharp.Endpoint.LanguageModel model, Newtonsoft.Json.Linq.JToken requestObject) [0x0024b] in <5f96298298f74346ad96eb79547a94e4>:0 \n at OmniSharp.Stdio.Host.HandleRequest (System.String json, Microsoft.Extensions.Logging.ILogger logger) [0x000f3] in <25aad3e40a2c409a9df3868c7895a306>:0 \nSystem.TypeLoadException: Could not load file or assembly 'Microsoft.CodeAnalysis, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies.\"",
"Body": null,
"Seq": 11156,
"Type": "response"
}
[warn]: OmniSharp.Stdio.Host
************ Request ************
{
"Type": "request",
"Seq": 123,
"Command": "/v2/getcodeactions",
"Arguments": {
"FileName": "/Users/XXX/Projects/testapi/Program.cs",
"Line": 18,
"Column": 11
}
}
[fail]: OmniSharp.Stdio.Host
************ Response (43.9858ms) ************
{
"Request_seq": 123,
"Command": "/v2/getcodeactions",
"Running": true,
"Success": false,
"Message": "\"System.Reflection.ReflectionTypeLoadException: Exception of type 'System.Reflection.ReflectionTypeLoadException' was thrown.\nCould not load file or assembly 'Microsoft.CodeAnalysis, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies.\n at (wrapper managed-to-native) System.Reflection.Assembly.GetTypes(System.Reflection.Assembly,bool)\n at System.Reflection.Assembly.GetTypes () [0x00000] in <36514b14425c4337b446653c547aa9c3>:0 \n at System.Reflection.Assembly+<get_DefinedTypes>d__127.MoveNext () [0x0001e] in <36514b14425c4337b446653c547aa9c3>:0 \n at System.Linq.Enumerable+SelectManySingleSelectorIterator`2[TSource,TResult].MoveNext () [0x0006f] in <14c1495deda74532849f8ec10b438611>:0 \n at System.Linq.Enumerable+WhereSelectEnumerableIterator`2[TSource,TResult].MoveNext () [0x00059] in <14c1495deda74532849f8ec10b438611>:0 \n at System.Linq.Enumerable+WhereEnumerableIterator`1[TSource].MoveNext () [0x0004e] in <14c1495deda74532849f8ec10b438611>:0 \n at System.Collections.Generic.LargeArrayBuilder`1[T].AddRange (System.Collections.Generic.IEnumerable`1[T] items) [0x0003d] in <14c1495deda74532849f8ec10b438611>:0 \n at System.Collections.Generic.SparseArrayBuilder`1[T].AddRange (System.Collections.Generic.IEnumerable`1[T] items) [0x00000] in <14c1495deda74532849f8ec10b438611>:0 \n at System.Collections.Generic.SparseArrayBuilder`1[T].ReserveOrAdd (System.Collections.Generic.IEnumerable`1[T] items) [0x00017] in <14c1495deda74532849f8ec10b438611>:0 \n at System.Linq.Enumerable+Concat2Iterator`1[TSource].ToArray () [0x00015] in <14c1495deda74532849f8ec10b438611>:0 \n at System.Linq.Enumerable.ToArray[TSource] (System.Collections.Generic.IEnumerable`1[T] source) [0x0001f] in <14c1495deda74532849f8ec10b438611>:0 \n at System.Collections.Immutable.ImmutableArray.CreateRange[T] (System.Collections.Generic.IEnumerable`1[T] items) [0x0004d] in <be358f84962848a48784e4a9d001abe1>:0 \n at System.Collections.Immutable.ImmutableArray.ToImmutableArray[TSource] (System.Collections.Generic.IEnumerable`1[T] items) [0x0000f] in <be358f84962848a48784e4a9d001abe1>:0 \n at OmniSharp.Roslyn.CSharp.Services.Refactoring.V2.CachingCodeFixProviderForProjects.LoadFrom (Microsoft.CodeAnalysis.Project project) [0x000d5] in <7833e4dfb11c41969fc8bb341c494975>:0 \n at OmniSharp.Roslyn.CSharp.Services.Refactoring.V2.CachingCodeFixProviderForProjects.GetAllCodeFixesForProject (Microsoft.CodeAnalysis.ProjectId projectId) [0x00045] in <7833e4dfb11c41969fc8bb341c494975>:0 \n at OmniSharp.Roslyn.CSharp.Services.Refactoring.V2.BaseCodeActionService`2[TRequest,TResponse].GetSortedCodeFixProviders (Microsoft.CodeAnalysis.Document document) [0x00011] in <7833e4dfb11c41969fc8bb341c494975>:0 \n at OmniSharp.Roslyn.CSharp.Services.Refactoring.V2.BaseCodeActionService`2[TRequest,TResponse].AppendFixesAsync (Microsoft.CodeAnalysis.Document document, Microsoft.CodeAnalysis.Text.TextSpan span, System.Collections.Generic.IEnumerable`1[T] diagnostics, System.Collections.Generic.List`1[T] codeActions) [0x0003e] in <7833e4dfb11c41969fc8bb341c494975>:0 \n at OmniSharp.Roslyn.CSharp.Services.Refactoring.V2.BaseCodeActionService`2[TRequest,TResponse].CollectCodeFixesActions (Microsoft.CodeAnalysis.Document document, Microsoft.CodeAnalysis.Text.TextSpan span, System.Collections.Generic.List`1[T] codeActions) [0x001c1] in <7833e4dfb11c41969fc8bb341c494975>:0 \n at OmniSharp.Roslyn.CSharp.Services.Refactoring.V2.BaseCodeActionService`2[TRequest,TResponse].GetAvailableCodeActions (OmniSharp.Models.V2.CodeActions.ICodeActionRequest request) [0x001a4] in <7833e4dfb11c41969fc8bb341c494975>:0 \n at OmniSharp.Roslyn.CSharp.Services.Refactoring.V2.GetCodeActionsService.Handle (OmniSharp.Models.V2.CodeActions.GetCodeActionsRequest request) [0x0006b] in <7833e4dfb11c41969fc8bb341c494975>:0 \n at OmniSharp.Endpoint.EndpointHandler`2[TRequest,TResponse].GetFirstNotEmptyResponseFromHandlers (OmniSharp.Endpoint.Exports.ExportHandler`2[TRequest,TResponse][] handlers, TRequest request) [0x00099] in <5f96298298f74346ad96eb79547a94e4>:0 \n at OmniSharp.Endpoint.EndpointHandler`2[TRequest,TResponse].HandleRequestForLanguage (System.String language, TRequest request, OmniSharp.Protocol.RequestPacket packet) [0x00163] in <5f96298298f74346ad96eb79547a94e4>:0 \n at OmniSharp.Endpoint.EndpointHandler`2[TRequest,TResponse].Process (OmniSharp.Protocol.RequestPacket packet, OmniSharp.Endpoint.LanguageModel model, Newtonsoft.Json.Linq.JToken requestObject) [0x0024b] in <5f96298298f74346ad96eb79547a94e4>:0 \n at OmniSharp.Stdio.Host.HandleRequest (System.String json, Microsoft.Extensions.Logging.ILogger logger) [0x000f3] in <25aad3e40a2c409a9df3868c7895a306>:0 \nSystem.TypeLoadException: Could not load file or assembly 'Microsoft.CodeAnalysis, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies.\"",
"Body": null,
"Seq": 11176,
"Type": "response"
}
找出问题所在。它与 dotnet SDK 6.0.200 有关。因此,当回滚到 SDK 版本 6.0.100 时一切正常。
(与arm或x86_64版SDK无关)
我创建了一个新的 Web-API 项目并使用 dotnet cli 引用了一个新创建的 class 库。这两个项目都包含在解决方案中。
我已经安装了 Apple Silicon 版本的 VSCode (1.64.2) 以及 arm64 Dotnet-Sdk (6.0.200)。
这是我使用过的命令:
dotnet new sln -n test
dotnet new webapi -n testapi
dotnet new classlib -n testlib
dotnet sln add testapi
dotnet sln add testlib
cd testapi
dotnet add reference ../testlib
当我尝试在 testapi
项目中使用自动导入 using 语句时,它显示 没有可用的代码操作 。当我在 testlib
项目中尝试相同时,它按预期工作。
在 Omnisharp 日志中,我看到以下错误:
[warn]: OmniSharp.Stdio.Host
************ Request ************
{
"Type": "request",
"Seq": 120,
"Command": "/v2/getcodeactions",
"Arguments": {
"FileName": "/Users/XXX/Projects/testapi/Program.cs",
"Line": 18,
"Column": 11
}
}
[fail]: OmniSharp.Stdio.Host
************ Response (43.8339ms) ************
{
"Request_seq": 120,
"Command": "/v2/getcodeactions",
"Running": true,
"Success": false,
"Message": "\"System.Reflection.ReflectionTypeLoadException: Exception of type 'System.Reflection.ReflectionTypeLoadException' was thrown.\nCould not load file or assembly 'Microsoft.CodeAnalysis, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies.\n at (wrapper managed-to-native) System.Reflection.Assembly.GetTypes(System.Reflection.Assembly,bool)\n at System.Reflection.Assembly.GetTypes () [0x00000] in <36514b14425c4337b446653c547aa9c3>:0 \n at System.Reflection.Assembly+<get_DefinedTypes>d__127.MoveNext () [0x0001e] in <36514b14425c4337b446653c547aa9c3>:0 \n at System.Linq.Enumerable+SelectManySingleSelectorIterator`2[TSource,TResult].MoveNext () [0x0006f] in <14c1495deda74532849f8ec10b438611>:0 \n at System.Linq.Enumerable+WhereSelectEnumerableIterator`2[TSource,TResult].MoveNext () [0x00059] in <14c1495deda74532849f8ec10b438611>:0 \n at System.Linq.Enumerable+WhereEnumerableIterator`1[TSource].MoveNext () [0x0004e] in <14c1495deda74532849f8ec10b438611>:0 \n at System.Collections.Generic.LargeArrayBuilder`1[T].AddRange (System.Collections.Generic.IEnumerable`1[T] items) [0x0003d] in <14c1495deda74532849f8ec10b438611>:0 \n at System.Collections.Generic.SparseArrayBuilder`1[T].AddRange (System.Collections.Generic.IEnumerable`1[T] items) [0x00000] in <14c1495deda74532849f8ec10b438611>:0 \n at System.Collections.Generic.SparseArrayBuilder`1[T].ReserveOrAdd (System.Collections.Generic.IEnumerable`1[T] items) [0x00017] in <14c1495deda74532849f8ec10b438611>:0 \n at System.Linq.Enumerable+Concat2Iterator`1[TSource].ToArray () [0x00015] in <14c1495deda74532849f8ec10b438611>:0 \n at System.Linq.Enumerable.ToArray[TSource] (System.Collections.Generic.IEnumerable`1[T] source) [0x0001f] in <14c1495deda74532849f8ec10b438611>:0 \n at System.Collections.Immutable.ImmutableArray.CreateRange[T] (System.Collections.Generic.IEnumerable`1[T] items) [0x0004d] in <be358f84962848a48784e4a9d001abe1>:0 \n at System.Collections.Immutable.ImmutableArray.ToImmutableArray[TSource] (System.Collections.Generic.IEnumerable`1[T] items) [0x0000f] in <be358f84962848a48784e4a9d001abe1>:0 \n at OmniSharp.Roslyn.CSharp.Services.Refactoring.V2.CachingCodeFixProviderForProjects.LoadFrom (Microsoft.CodeAnalysis.Project project) [0x000d5] in <7833e4dfb11c41969fc8bb341c494975>:0 \n at OmniSharp.Roslyn.CSharp.Services.Refactoring.V2.CachingCodeFixProviderForProjects.GetAllCodeFixesForProject (Microsoft.CodeAnalysis.ProjectId projectId) [0x00045] in <7833e4dfb11c41969fc8bb341c494975>:0 \n at OmniSharp.Roslyn.CSharp.Services.Refactoring.V2.BaseCodeActionService`2[TRequest,TResponse].GetSortedCodeFixProviders (Microsoft.CodeAnalysis.Document document) [0x00011] in <7833e4dfb11c41969fc8bb341c494975>:0 \n at OmniSharp.Roslyn.CSharp.Services.Refactoring.V2.BaseCodeActionService`2[TRequest,TResponse].AppendFixesAsync (Microsoft.CodeAnalysis.Document document, Microsoft.CodeAnalysis.Text.TextSpan span, System.Collections.Generic.IEnumerable`1[T] diagnostics, System.Collections.Generic.List`1[T] codeActions) [0x0003e] in <7833e4dfb11c41969fc8bb341c494975>:0 \n at OmniSharp.Roslyn.CSharp.Services.Refactoring.V2.BaseCodeActionService`2[TRequest,TResponse].CollectCodeFixesActions (Microsoft.CodeAnalysis.Document document, Microsoft.CodeAnalysis.Text.TextSpan span, System.Collections.Generic.List`1[T] codeActions) [0x001c1] in <7833e4dfb11c41969fc8bb341c494975>:0 \n at OmniSharp.Roslyn.CSharp.Services.Refactoring.V2.BaseCodeActionService`2[TRequest,TResponse].GetAvailableCodeActions (OmniSharp.Models.V2.CodeActions.ICodeActionRequest request) [0x001a4] in <7833e4dfb11c41969fc8bb341c494975>:0 \n at OmniSharp.Roslyn.CSharp.Services.Refactoring.V2.GetCodeActionsService.Handle (OmniSharp.Models.V2.CodeActions.GetCodeActionsRequest request) [0x0006b] in <7833e4dfb11c41969fc8bb341c494975>:0 \n at OmniSharp.Endpoint.EndpointHandler`2[TRequest,TResponse].GetFirstNotEmptyResponseFromHandlers (OmniSharp.Endpoint.Exports.ExportHandler`2[TRequest,TResponse][] handlers, TRequest request) [0x00099] in <5f96298298f74346ad96eb79547a94e4>:0 \n at OmniSharp.Endpoint.EndpointHandler`2[TRequest,TResponse].HandleRequestForLanguage (System.String language, TRequest request, OmniSharp.Protocol.RequestPacket packet) [0x00163] in <5f96298298f74346ad96eb79547a94e4>:0 \n at OmniSharp.Endpoint.EndpointHandler`2[TRequest,TResponse].Process (OmniSharp.Protocol.RequestPacket packet, OmniSharp.Endpoint.LanguageModel model, Newtonsoft.Json.Linq.JToken requestObject) [0x0024b] in <5f96298298f74346ad96eb79547a94e4>:0 \n at OmniSharp.Stdio.Host.HandleRequest (System.String json, Microsoft.Extensions.Logging.ILogger logger) [0x000f3] in <25aad3e40a2c409a9df3868c7895a306>:0 \nSystem.TypeLoadException: Could not load file or assembly 'Microsoft.CodeAnalysis, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies.\"",
"Body": null,
"Seq": 11156,
"Type": "response"
}
[warn]: OmniSharp.Stdio.Host
************ Request ************
{
"Type": "request",
"Seq": 123,
"Command": "/v2/getcodeactions",
"Arguments": {
"FileName": "/Users/XXX/Projects/testapi/Program.cs",
"Line": 18,
"Column": 11
}
}
[fail]: OmniSharp.Stdio.Host
************ Response (43.9858ms) ************
{
"Request_seq": 123,
"Command": "/v2/getcodeactions",
"Running": true,
"Success": false,
"Message": "\"System.Reflection.ReflectionTypeLoadException: Exception of type 'System.Reflection.ReflectionTypeLoadException' was thrown.\nCould not load file or assembly 'Microsoft.CodeAnalysis, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies.\n at (wrapper managed-to-native) System.Reflection.Assembly.GetTypes(System.Reflection.Assembly,bool)\n at System.Reflection.Assembly.GetTypes () [0x00000] in <36514b14425c4337b446653c547aa9c3>:0 \n at System.Reflection.Assembly+<get_DefinedTypes>d__127.MoveNext () [0x0001e] in <36514b14425c4337b446653c547aa9c3>:0 \n at System.Linq.Enumerable+SelectManySingleSelectorIterator`2[TSource,TResult].MoveNext () [0x0006f] in <14c1495deda74532849f8ec10b438611>:0 \n at System.Linq.Enumerable+WhereSelectEnumerableIterator`2[TSource,TResult].MoveNext () [0x00059] in <14c1495deda74532849f8ec10b438611>:0 \n at System.Linq.Enumerable+WhereEnumerableIterator`1[TSource].MoveNext () [0x0004e] in <14c1495deda74532849f8ec10b438611>:0 \n at System.Collections.Generic.LargeArrayBuilder`1[T].AddRange (System.Collections.Generic.IEnumerable`1[T] items) [0x0003d] in <14c1495deda74532849f8ec10b438611>:0 \n at System.Collections.Generic.SparseArrayBuilder`1[T].AddRange (System.Collections.Generic.IEnumerable`1[T] items) [0x00000] in <14c1495deda74532849f8ec10b438611>:0 \n at System.Collections.Generic.SparseArrayBuilder`1[T].ReserveOrAdd (System.Collections.Generic.IEnumerable`1[T] items) [0x00017] in <14c1495deda74532849f8ec10b438611>:0 \n at System.Linq.Enumerable+Concat2Iterator`1[TSource].ToArray () [0x00015] in <14c1495deda74532849f8ec10b438611>:0 \n at System.Linq.Enumerable.ToArray[TSource] (System.Collections.Generic.IEnumerable`1[T] source) [0x0001f] in <14c1495deda74532849f8ec10b438611>:0 \n at System.Collections.Immutable.ImmutableArray.CreateRange[T] (System.Collections.Generic.IEnumerable`1[T] items) [0x0004d] in <be358f84962848a48784e4a9d001abe1>:0 \n at System.Collections.Immutable.ImmutableArray.ToImmutableArray[TSource] (System.Collections.Generic.IEnumerable`1[T] items) [0x0000f] in <be358f84962848a48784e4a9d001abe1>:0 \n at OmniSharp.Roslyn.CSharp.Services.Refactoring.V2.CachingCodeFixProviderForProjects.LoadFrom (Microsoft.CodeAnalysis.Project project) [0x000d5] in <7833e4dfb11c41969fc8bb341c494975>:0 \n at OmniSharp.Roslyn.CSharp.Services.Refactoring.V2.CachingCodeFixProviderForProjects.GetAllCodeFixesForProject (Microsoft.CodeAnalysis.ProjectId projectId) [0x00045] in <7833e4dfb11c41969fc8bb341c494975>:0 \n at OmniSharp.Roslyn.CSharp.Services.Refactoring.V2.BaseCodeActionService`2[TRequest,TResponse].GetSortedCodeFixProviders (Microsoft.CodeAnalysis.Document document) [0x00011] in <7833e4dfb11c41969fc8bb341c494975>:0 \n at OmniSharp.Roslyn.CSharp.Services.Refactoring.V2.BaseCodeActionService`2[TRequest,TResponse].AppendFixesAsync (Microsoft.CodeAnalysis.Document document, Microsoft.CodeAnalysis.Text.TextSpan span, System.Collections.Generic.IEnumerable`1[T] diagnostics, System.Collections.Generic.List`1[T] codeActions) [0x0003e] in <7833e4dfb11c41969fc8bb341c494975>:0 \n at OmniSharp.Roslyn.CSharp.Services.Refactoring.V2.BaseCodeActionService`2[TRequest,TResponse].CollectCodeFixesActions (Microsoft.CodeAnalysis.Document document, Microsoft.CodeAnalysis.Text.TextSpan span, System.Collections.Generic.List`1[T] codeActions) [0x001c1] in <7833e4dfb11c41969fc8bb341c494975>:0 \n at OmniSharp.Roslyn.CSharp.Services.Refactoring.V2.BaseCodeActionService`2[TRequest,TResponse].GetAvailableCodeActions (OmniSharp.Models.V2.CodeActions.ICodeActionRequest request) [0x001a4] in <7833e4dfb11c41969fc8bb341c494975>:0 \n at OmniSharp.Roslyn.CSharp.Services.Refactoring.V2.GetCodeActionsService.Handle (OmniSharp.Models.V2.CodeActions.GetCodeActionsRequest request) [0x0006b] in <7833e4dfb11c41969fc8bb341c494975>:0 \n at OmniSharp.Endpoint.EndpointHandler`2[TRequest,TResponse].GetFirstNotEmptyResponseFromHandlers (OmniSharp.Endpoint.Exports.ExportHandler`2[TRequest,TResponse][] handlers, TRequest request) [0x00099] in <5f96298298f74346ad96eb79547a94e4>:0 \n at OmniSharp.Endpoint.EndpointHandler`2[TRequest,TResponse].HandleRequestForLanguage (System.String language, TRequest request, OmniSharp.Protocol.RequestPacket packet) [0x00163] in <5f96298298f74346ad96eb79547a94e4>:0 \n at OmniSharp.Endpoint.EndpointHandler`2[TRequest,TResponse].Process (OmniSharp.Protocol.RequestPacket packet, OmniSharp.Endpoint.LanguageModel model, Newtonsoft.Json.Linq.JToken requestObject) [0x0024b] in <5f96298298f74346ad96eb79547a94e4>:0 \n at OmniSharp.Stdio.Host.HandleRequest (System.String json, Microsoft.Extensions.Logging.ILogger logger) [0x000f3] in <25aad3e40a2c409a9df3868c7895a306>:0 \nSystem.TypeLoadException: Could not load file or assembly 'Microsoft.CodeAnalysis, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies.\"",
"Body": null,
"Seq": 11176,
"Type": "response"
}
找出问题所在。它与 dotnet SDK 6.0.200 有关。因此,当回滚到 SDK 版本 6.0.100 时一切正常。 (与arm或x86_64版SDK无关)