Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

editor.action.quickFix abnormal #7926

Open
nczsl opened this issue Jan 14, 2025 · 7 comments
Open

editor.action.quickFix abnormal #7926

nczsl opened this issue Jan 14, 2025 · 7 comments

Comments

@nczsl
Copy link

nczsl commented Jan 14, 2025

Environment data

dotnet --info output:

.NET SDK:
Version: 9.0.101
Commit: eedb237549
Workload version: 9.0.100-manifests.3068a692
MSBuild version: 17.12.12+1cce77968

运行时环境:
OS Name: Windows
OS Version: 10.0.19045
OS Platform: Windows
RID: win-x64
Base Path: C:\Program Files\dotnet\sdk\9.0.101\

已安装 .NET 工作负载:
没有要显示的已安装工作负载。
配置为在安装新清单时使用 loose manifests。

Host:
Version: 9.0.0
Architecture: x64
Commit: 9d5a6a9aa4

.NET SDKs installed:
8.0.404 [C:\Program Files\dotnet\sdk]
9.0.101 [C:\Program Files\dotnet\sdk]

.NET runtimes installed:
Microsoft.AspNetCore.App 8.0.11 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 9.0.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 8.0.11 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 9.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 8.0.11 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 9.0.0 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

Other architectures found:
None

Environment variables:
Not set

global.json file:
Not found

Learn more:
https://aka.ms/dotnet/info

Download .NET:
https://aka.ms/dotnet/download
VS Code version:
1.96.3
91fbdddc47bc9c09064bf7acf133d22631cbf083
x64
C# Extension version:
Version
2.61.28

OmniSharp log

Steps to reproduce

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior

A clear and concise description of what you expected to happen.

Actual behavior

in vscode csharp editor, keyboard shortcuts has problem , editor.action.quickFix abnormal; it Occurred after this update (Last Updated
2025-01-14, 10:49:56)

Additional context

Add any other context about the problem here.

@dibarbet
Copy link
Member

I'm not quite able to follow the repro steps or understand the issue. Would you mind sharing an image / GIF of both the expected behavior and actual broken behavior?

@nczsl
Copy link
Author

nczsl commented Jan 15, 2025

Image

I'm not quite able to follow the repro steps or understand the issue. Would you mind sharing an image / GIF of both the expected behavior and actual broken behavior?

In the past, when there was an error of missing a namespace, the option to use the namespace could be automatically popped up through shortcut keys. However, it seems that this is no longer possible. I don't think these prompts are correct

@dibarbet
Copy link
Member

dibarbet commented Jan 16, 2025

@nczsl Ah thanks - I understand what the problem is now. I can't reproduce the issue myself, but from the screenshot it looks like no c# actions are showing up at all.

Would you mind collecting the C# logs as described here?https://github.com/dotnet/vscode-csharp/blob/main/SUPPORT.md#collecting-general-logs

@nczsl
Copy link
Author

nczsl commented Jan 18, 2025

that is a omnisharp log on output port:

}
[warn]: OmniSharp.Stdio.Host
************ Request ************
{
"Type": "request",
"Seq": 145,
"Command": "/v2/getcodeactions",
"Arguments": {
"FileName": "e:\netenv\apps\ways2025\Controllers\expevo\HomeController.cs",
"Line": 30,
"Column": 26
}
}
[fail]: OmniSharp.Stdio.Host
************ Response (6.5283ms) ************
{
"Request_seq": 145,
"Command": "/v2/getcodeactions",
"Running": true,
"Success": false,
"Message": ""System.InvalidOperationException: Unable to load Microsoft.AspNetCore.Razor.Utilities.Shared\r\n ---> System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.AspNetCore.Razor.Utilities.Shared, Version=9.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. 系统找不到指定的文件。\r\nFile name: 'Microsoft.AspNetCore.Razor.Utilities.Shared, Version=9.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'\r\n at System.Reflection.RuntimeAssembly.g____PInvoke|49_0(NativeAssemblyNameParts* __pAssemblyNameParts_native, ObjectHandleOnStack __requestingAssembly_native, StackCrawlMarkHandle __stackMark_native, Int32 __throwOnFileNotFound_native, ObjectHandleOnStack __assemblyLoadContext_native, ObjectHandleOnStack __retAssembly_native)\r\n at System.Reflection.RuntimeAssembly.g____PInvoke|49_0(NativeAssemblyNameParts* __pAssemblyNameParts_native, ObjectHandleOnStack __requestingAssembly_native, StackCrawlMarkHandle __stackMark_native, Int32 __throwOnFileNotFound_native, ObjectHandleOnStack __assemblyLoadContext_native, ObjectHandleOnStack __retAssembly_native)\r\n at System.Reflection.RuntimeAssembly.InternalLoad(AssemblyName assemblyName, StackCrawlMark& stackMark, AssemblyLoadContext assemblyLoadContext, RuntimeAssembly requestingAssembly, Boolean throwOnFileNotFound)\r\n at System.Reflection.Assembly.Load(AssemblyName assemblyRef)\r\n at System.AppDomain.Load(AssemblyName assemblyRef)\r\n at Microsoft.CodeAnalysis.AnalyzerAssemblyLoader.Load(AssemblyName assemblyName, String assemblyOriginalPath)\r\n at Microsoft.CodeAnalysis.AnalyzerAssemblyLoader.LoadFromPath(String originalAnalyzerPath)\r\n --- End of inner exception stack trace ---\r\n at Microsoft.CodeAnalysis.AnalyzerAssemblyLoader.LoadFromPath(String originalAnalyzerPath)\r\n at Microsoft.CodeAnalysis.Diagnostics.AnalyzerFileReference.GetAssembly()\r\n at OmniSharp.Roslyn.CSharp.Services.Refactoring.V2.CachingCodeFixProviderForProjects.<>c__DisplayClass6_0.b__0(AnalyzerFileReference analyzerFileReference) in D:\\a\\1\\s\\src\\OmniSharp.Roslyn.CSharp\\Services\\Refactoring\\V2\\CachingCodeFixProviderForProjects.cs:line 64\r\n at System.Linq.Enumerable.SelectManySingleSelectorIterator2.MoveNext()\\r\\n at System.Linq.Enumerable.IEnumerableWhereSelectIterator2.MoveNext()\r\n at System.Collections.Generic.SegmentedArrayBuilder1.AddNonICollectionRange(IEnumerable1 source)\r\n at System.Linq.Enumerable.Concat2Iterator1.ToArray()\\r\\n at System.Collections.Immutable.ImmutableArray.CreateRange[T](IEnumerable1 items)\r\n at OmniSharp.Roslyn.CSharp.Services.Refactoring.V2.CachingCodeFixProviderForProjects.LoadFrom(Project project) in D:\\a\\1\\s\\src\\OmniSharp.Roslyn.CSharp\\Services\\Refactoring\\V2\\CachingCodeFixProviderForProjects.cs:line 95\r\n at OmniSharp.Roslyn.CSharp.Services.Refactoring.V2.CachingCodeFixProviderForProjects.GetAllCodeFixesForProject(ProjectId projectId) in D:\\a\\1\\s\\src\\OmniSharp.Roslyn.CSharp\\Services\\Refactoring\\V2\\CachingCodeFixProviderForProjects.cs:line 57\r\n at OmniSharp.Roslyn.CSharp.Services.Refactoring.V2.BaseCodeActionService2.GetSortedCodeFixProviders(Document document) in D:\\\\a\\\\1\\\\s\\\\src\\\\OmniSharp.Roslyn.CSharp\\\\Services\\\\Refactoring\\\\V2\\\\BaseCodeActionService.cs:line 170\\r\\n at OmniSharp.Roslyn.CSharp.Services.Refactoring.V2.BaseCodeActionService2.AppendFixesAsync(Document document, TextSpan span, IEnumerable1 diagnostics, List1 codeActions) in D:\\a\\1\\s\\src\\OmniSharp.Roslyn.CSharp\\Services\\Refactoring\\V2\\BaseCodeActionService.cs:line 142\r\n at OmniSharp.Roslyn.CSharp.Services.Refactoring.V2.BaseCodeActionService2.CollectCodeFixesActions(Document document, TextSpan span, List1 codeActions) in D:\\a\\1\\s\\src\\OmniSharp.Roslyn.CSharp\\Services\\Refactoring\\V2\\BaseCodeActionService.cs:line 134\r\n at OmniSharp.Roslyn.CSharp.Services.Refactoring.V2.BaseCodeActionService2.GetAvailableCodeActions(ICodeActionRequest request) in D:\\\\a\\\\1\\\\s\\\\src\\\\OmniSharp.Roslyn.CSharp\\\\Services\\\\Refactoring\\\\V2\\\\BaseCodeActionService.cs:line 86\\r\\n at OmniSharp.Roslyn.CSharp.Services.Refactoring.V2.GetCodeActionsService.Handle(GetCodeActionsRequest request) in D:\\\\a\\\\1\\\\s\\\\src\\\\OmniSharp.Roslyn.CSharp\\\\Services\\\\Refactoring\\\\V2\\\\GetCodeActionsService.cs:line 34\\r\\n at OmniSharp.Endpoint.EndpointHandler2.GetFirstNotEmptyResponseFromHandlers(ExportHandler2[] handlers, TRequest request)\\r\\n at OmniSharp.Endpoint.EndpointHandler2.HandleRequestForLanguage(String language, TRequest request, RequestPacket packet) in D:\\a\\1\\s\\src\\OmniSharp.Host\\Endpoint\\EndpointHandler.cs:line 229\r\n at OmniSharp.Endpoint.EndpointHandler2.Process(RequestPacket packet, LanguageModel model, JToken requestObject) in D:\\\\a\\\\1\\\\s\\\\src\\\\OmniSharp.Host\\\\Endpoint\\\\EndpointHandler.cs:line 130\\r\\n at OmniSharp.Stdio.Host.HandleRequest(String json, ILogger logger) in D:\\\\a\\\\1\\\\s\\\\src\\\\OmniSharp.Stdio\\\\Host.cs:line 218\"", "Body": null, "Seq": 658, "Type": "response" } [warn]: OmniSharp.Roslyn.CSharp.Services.Navigation.FindUsagesService No symbol found. File: e:\netenv\apps\ways2025\Controllers\expevo\HomeController.cs, Line: 30, Column: 33. [warn]: OmniSharp.Stdio.Host ************ Request ************ { "Type": "request", "Seq": 147, "Command": "/v2/getcodeactions", "Arguments": { "FileName": "e:\\netenv\\apps\\ways2025\\Controllers\\expevo\\HomeController.cs", "Line": 30, "Column": 33 } } [fail]: OmniSharp.Stdio.Host ************ Response (8.0198ms) ************ { "Request_seq": 147, "Command": "/v2/getcodeactions", "Running": true, "Success": false, "Message": "\"System.InvalidOperationException: Unable to load Microsoft.AspNetCore.Razor.Utilities.Shared\\r\\n ---> System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.AspNetCore.Razor.Utilities.Shared, Version=9.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. 系统找不到指定的文件。\\r\\nFile name: 'Microsoft.AspNetCore.Razor.Utilities.Shared, Version=9.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'\\r\\n at System.Reflection.RuntimeAssembly.<InternalLoad>g____PInvoke|49_0(NativeAssemblyNameParts* __pAssemblyNameParts_native, ObjectHandleOnStack __requestingAssembly_native, StackCrawlMarkHandle __stackMark_native, Int32 __throwOnFileNotFound_native, ObjectHandleOnStack __assemblyLoadContext_native, ObjectHandleOnStack __retAssembly_native)\\r\\n at System.Reflection.RuntimeAssembly.<InternalLoad>g____PInvoke|49_0(NativeAssemblyNameParts* __pAssemblyNameParts_native, ObjectHandleOnStack __requestingAssembly_native, StackCrawlMarkHandle __stackMark_native, Int32 __throwOnFileNotFound_native, ObjectHandleOnStack __assemblyLoadContext_native, ObjectHandleOnStack __retAssembly_native)\\r\\n at System.Reflection.RuntimeAssembly.InternalLoad(AssemblyName assemblyName, StackCrawlMark& stackMark, AssemblyLoadContext assemblyLoadContext, RuntimeAssembly requestingAssembly, Boolean throwOnFileNotFound)\\r\\n at System.Reflection.Assembly.Load(AssemblyName assemblyRef)\\r\\n at System.AppDomain.Load(AssemblyName assemblyRef)\\r\\n at Microsoft.CodeAnalysis.AnalyzerAssemblyLoader.Load(AssemblyName assemblyName, String assemblyOriginalPath)\\r\\n at Microsoft.CodeAnalysis.AnalyzerAssemblyLoader.LoadFromPath(String originalAnalyzerPath)\\r\\n --- End of inner exception stack trace ---\\r\\n at Microsoft.CodeAnalysis.AnalyzerAssemblyLoader.LoadFromPath(String originalAnalyzerPath)\\r\\n at Microsoft.CodeAnalysis.Diagnostics.AnalyzerFileReference.GetAssembly()\\r\\n at OmniSharp.Roslyn.CSharp.Services.Refactoring.V2.CachingCodeFixProviderForProjects.<>c__DisplayClass6_0.<LoadFrom>b__0(AnalyzerFileReference analyzerFileReference) in D:\\\\a\\\\1\\\\s\\\\src\\\\OmniSharp.Roslyn.CSharp\\\\Services\\\\Refactoring\\\\V2\\\\CachingCodeFixProviderForProjects.cs:line 64\\r\\n at System.Linq.Enumerable.SelectManySingleSelectorIterator2.MoveNext()\r\n at System.Linq.Enumerable.IEnumerableWhereSelectIterator2.MoveNext()\\r\\n at System.Collections.Generic.SegmentedArrayBuilder1.AddNonICollectionRange(IEnumerable1 source)\\r\\n at System.Linq.Enumerable.Concat2Iterator1.ToArray()\r\n at System.Collections.Immutable.ImmutableArray.CreateRange[T](IEnumerable1 items)\\r\\n at OmniSharp.Roslyn.CSharp.Services.Refactoring.V2.CachingCodeFixProviderForProjects.LoadFrom(Project project) in D:\\\\a\\\\1\\\\s\\\\src\\\\OmniSharp.Roslyn.CSharp\\\\Services\\\\Refactoring\\\\V2\\\\CachingCodeFixProviderForProjects.cs:line 95\\r\\n at OmniSharp.Roslyn.CSharp.Services.Refactoring.V2.CachingCodeFixProviderForProjects.GetAllCodeFixesForProject(ProjectId projectId) in D:\\\\a\\\\1\\\\s\\\\src\\\\OmniSharp.Roslyn.CSharp\\\\Services\\\\Refactoring\\\\V2\\\\CachingCodeFixProviderForProjects.cs:line 57\\r\\n at OmniSharp.Roslyn.CSharp.Services.Refactoring.V2.BaseCodeActionService2.GetSortedCodeFixProviders(Document document) in D:\\a\\1\\s\\src\\OmniSharp.Roslyn.CSharp\\Services\\Refactoring\\V2\\BaseCodeActionService.cs:line 170\r\n at OmniSharp.Roslyn.CSharp.Services.Refactoring.V2.BaseCodeActionService2.AppendFixesAsync(Document document, TextSpan span, IEnumerable1 diagnostics, List1 codeActions) in D:\\\\a\\\\1\\\\s\\\\src\\\\OmniSharp.Roslyn.CSharp\\\\Services\\\\Refactoring\\\\V2\\\\BaseCodeActionService.cs:line 142\\r\\n at OmniSharp.Roslyn.CSharp.Services.Refactoring.V2.BaseCodeActionService2.CollectCodeFixesActions(Document document, TextSpan span, List1 codeActions) in D:\\\\a\\\\1\\\\s\\\\src\\\\OmniSharp.Roslyn.CSharp\\\\Services\\\\Refactoring\\\\V2\\\\BaseCodeActionService.cs:line 134\\r\\n at OmniSharp.Roslyn.CSharp.Services.Refactoring.V2.BaseCodeActionService2.GetAvailableCodeActions(ICodeActionRequest request) in D:\\a\\1\\s\\src\\OmniSharp.Roslyn.CSharp\\Services\\Refactoring\\V2\\BaseCodeActionService.cs:line 86\r\n at OmniSharp.Roslyn.CSharp.Services.Refactoring.V2.GetCodeActionsService.Handle(GetCodeActionsRequest request) in D:\\a\\1\\s\\src\\OmniSharp.Roslyn.CSharp\\Services\\Refactoring\\V2\\GetCodeActionsService.cs:line 34\r\n at OmniSharp.Endpoint.EndpointHandler2.GetFirstNotEmptyResponseFromHandlers(ExportHandler2[] handlers, TRequest request)\r\n at OmniSharp.Endpoint.EndpointHandler2.HandleRequestForLanguage(String language, TRequest request, RequestPacket packet) in D:\\\\a\\\\1\\\\s\\\\src\\\\OmniSharp.Host\\\\Endpoint\\\\EndpointHandler.cs:line 229\\r\\n at OmniSharp.Endpoint.EndpointHandler2.Process(RequestPacket packet, LanguageModel model, JToken requestObject) in D:\\a\\1\\s\\src\\OmniSharp.Host\\Endpoint\\EndpointHandler.cs:line 130\r\n at OmniSharp.Stdio.Host.HandleRequest(String json, ILogger logger) in D:\\a\\1\\s\\src\\OmniSharp.Stdio\\Host.cs:line 218"",
"Body": null,
"Seq": 663,
"Type": "response"
}

@nczsl
Copy link
Author

nczsl commented Jan 18, 2025

Is this related to me not installing. NET 8?

@dibarbet
Copy link
Member

Ah I am not sure, this looks like an error in O# related to loading Razor. I suspect it is related to the O# upgrade in the last release.

For now I would suggest seeing if downgrading to the previous extension version works. Or you could try out the Roslyn based server (instead of O# - dotnet.server.useOmnisharp to false).

@JoeRobich
Copy link
Member

The Razor extension for OmniSharp ships with version 7.0 of Microsoft.AspNetCore.Razor.Utilities.Shared.

@davidwengier How do you suggest resolving this for O#? Should we implement a similar analyzer assembly resolver for our project system?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants