editor.action.quickFix abnormal
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
- Go to '...'
- Click on '....'
- Scroll down to '....'
- 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.
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?
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
@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
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.<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": 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"
}
Is this related to me not installing. NET 8?
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).
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?
I believe I have similar? issue.
System:
Linux (Arch)
Environment:
dotnet8,9 (tested with) VSCode (vscodium-electron) Debugger: "C#" by muhammad-sammy
Packages:
dotnet-host 9.0.3.sdk104-1
dotnet-runtime 9.0.3.sdk104-1
dotnet-runtime-6.0 6.0.36.sdk136-2
dotnet-runtime-7.0 7.0.20.sdk120-2
dotnet-runtime-8.0-bin 8.0.14.sdk407-1
dotnet-sdk 9.0.3.sdk104-1
dotnet-sdk-6.0 6.0.36.sdk136-2
dotnet-sdk-7.0 7.0.20.sdk120-2
dotnet-sdk-8.0 8.0.14.sdk114-1
dotnet-targeting-pack 9.0.3.sdk104-1
dotnet-targeting-pack-6.0 6.0.36.sdk136-2
dotnet-targeting-pack-7.0 7.0.20.sdk120-2
dotnet-targeting-pack-8.0 8.0.14.sdk114-1
Output of dotnet --info:
.NET SDK:
Version: 9.0.104
Commit: 7931ad4860
Workload version: 9.0.100-manifests.dc2cb94f
MSBuild version: 17.12.27+7931ad486
Runtime Environment:
OS Name: arch
OS Version:
OS Platform: Linux
RID: arch-x64
Base Path: /usr/share/dotnet/sdk/9.0.104/
.NET workloads installed:
There are no installed workloads to display.
Configured to use loose manifests when installing new manifests.
Host:
Version: 9.0.3
Architecture: x64
Commit: 7931ad4860
.NET SDKs installed:
6.0.136 [/usr/share/dotnet/sdk]
7.0.120 [/usr/share/dotnet/sdk]
8.0.114 [/usr/share/dotnet/sdk]
9.0.104 [/usr/share/dotnet/sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 7.0.20 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 8.0.14 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 9.0.3 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 6.0.36 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 7.0.20 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 8.0.14 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 9.0.3 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
To reproduce(for me):
- Create webapi (
dotnet new webapi --use-program-main). - Open project in VSCode.
- Start typing some function (
Test("test")). - Try to use quick-fix to auto-generate it.
Expected:
"Quick fix" menu contains "Generate method" option. (and other too) (but it works flawlessly for console application)
What I get:
"Quick fix" menu is empty (except Continue(irrelevant))
And this errors in OmniSharp Log: omnlog.txt
TBH I would not open an issue cuz my setup is kinda specific, but this link was first that I found so here I am.
(In some time I will test it more, but I don't have time rn, and for me It's not critical.)
Related issues:
- https://github.com/OmniSharp/omnisharp-roslyn/issues/2648
- https://github.com/OmniSharp/omnisharp-roslyn/issues/2673
- https://github.com/dotnet/vscode-csharp/issues/6718
- https://github.com/dotnet/vscode-csharp/issues/7802
- https://github.com/dotnet/vscode-csharp/issues/7926
There is a known workaround mentioned here.
That approach is to add <RunAnalyzers>false</RunAnalyzers> to the project’s .csproj file.
However, this workaround is quite painful for projects that rely on source generators.
For those using OmniSharp in VS Code (and not using Razor in the project), another possible workaround is to remove the OmniSharp Razor plugin. This seems to resolve the issue in some cases.
Steps:
- Install the C# extension in VS Code and configure it to use OmniSharp (
"dotnet.server.useOmnisharp": true). - On first use, the C# extension will automatically download OmniSharp. At this point, a
.razoromnisharpdirectory is created under the extension’s directory (e.g.%USERPROFILE%\.vscode\extensions\ms-dotnettools.csharp-2.90.60-win32-x64). - In the OmniSharp output, confirm that errors such as
Unable to load Microsoft.AspNetCore.Razor.Utilities.Sharedappear. - Exit OmniSharp and VS Code, delete
OmniSharpPlugindirectory inside.razoromnisharpdirectory. - Restart VS Code and verify that:
- Warnings are displayed correctly.
- Quick Fix works as expected.
- Source Generators function properly.