Open CEbbinghaus opened 1 year ago
The reason is it has a hard timeout of 10 seconds, which is currently not configurable, and in your case it takes longer, and gets canceled.
One alternative is to use dotnet format from the command line.
e.g. dotnet format style
. See also https://learn.microsoft.com/en-us/dotnet/core/tools/dotnet-format
Dotnet format hasn't worked for me at all in the past no matter what I have tried. The version I can install is incompatible with the SDK we use and the version that is compatible I cannot install no matter what I try. For the moment its not an option so it would be really nice if this hard timeout would be configurable. Especially since this is just a huge project with 3k+ files so running the fix was always going to take a long time.
Sorry if this is a bit off-topic, but how do I access OmniSharp: Fix all occurrences of a code issue within project
? I've only ever had these three Omnisharp commands in all Omnisharp installations.
Omnisharp: Restart Omnisharp
Omnisharp: Select Project
Omnisharp: Analyze all projects
I've been using Omnisharp daily on several different machines at least since the day 1.7.0 was released (8th of February 2017) and I'm wondering if I've completely missed something obvious all those years.
@Ghostbird I have the same issue, seems like the option disappeared somewhere between version 1.25.0 and 1.25.1. I reverted to an older version and it seems to work fine. Except since 1.25 isn't compatible with .Net7, I'll unfortunately have to make do without those additional features
Edit: Funnily enough, going in the keyboard shortcuts and adding a new shortcut for command @command:o.fixAll.solution
actually allows me to access the fixAll feature
So the feature itself still seems to work, the ctrl+P window simply does not display it.
I'm running into a similar thing where it's taking longer than 10 seconds and timing out. I thought omnisharp.json
would attach something like the RoslynExtensionsOptions.documentAnalysisTimeoutMs
to fixes but just found (through experience and this issue) that's not the case.
I think this is no longer going to be supported. This is an Omnisharp feature and this extension no longer uses Omnisharp. These commands also no longer appear, unless you disable the newer features, and revert to Omnisharp in the settings panel under Extensions » C# » Omnisharp. Note that for this to work the C# Dev Kit must not be installed.
In dropping Omnisharp this extension has dropped a lot of features. However most of those features didn't work properly anyway, because, as this issues exemplifies, Omnisharp commands almost always time-out.
I don't have timeout issue, fails immediately. This feature has worked as recently as a couple days ago and I use often to remove unused usings. Here is my log:
************ Request ************
{
"Type": "request",
"Seq": 172,
"Command": "/getfixall",
"Arguments": {
"FileName": "c:\\BTR\\Camelot\\Api\\WebService.Proxy\\Api\\tests\\Integration\\McpEndpointTests\\UploadEndpointTests.cs",
"Scope": "Project"
}
}
[fail]: OmniSharp.Stdio.Host
************ Response (1.9120ms) ************
{
"Request_seq": 172,
"Command": "/getfixall",
"Running": true,
"Success": false,
"Message": "\"System.Reflection.ReflectionTypeLoadException: Unable to load one or more of the requested types.\\r\\nAccess is denied: 'Microsoft.AspNetCore.Razor.PooledObjects.PooledObject`1[System.Collections.Immutable.ImmutableArray`1+Builder[Microsoft.AspNetCore.Razor.Language.SourceMapping]]'.\\r\\nAccess is denied: 'Microsoft.AspNetCore.Razor.PooledObjects.PooledObject`1[System.Collections.Immutable.ImmutableArray`1+Builder[Microsoft.AspNetCore.Razor.Language.SourceMapping]]'.\\r\\n at System.Reflection.RuntimeModule.GetTypes(RuntimeModule module)\\r\\n at System.Reflection.RuntimeAssembly.get_DefinedTypes()\\r\\n at System.Linq.Enumerable.SelectManySingleSelectorIterator`2.MoveNext()\\r\\n at System.Linq.Enumerable.WhereEnumerableIterator`1.MoveNext()\\r\\n at System.Collections.Generic.LargeArrayBuilder`1.AddRange(IEnumerable`1 items)\\r\\n at System.Collections.Generic.SparseArrayBuilder`1.ReserveOrAdd(IEnumerable`1 items)\\r\\n at System.Linq.Enumerable.Concat2Iterator`1.ToArray()\\r\\n at System.Collections.Immutable.ImmutableArray.CreateRange[T](IEnumerable`1 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.BaseCodeActionService`2.GetCodeFixProviders(ProjectId project) in D:\\\\a\\\\1\\\\s\\\\src\\\\OmniSharp.Roslyn.CSharp\\\\Services\\\\Refactoring\\\\V2\\\\BaseCodeActionService.cs:line 257\\r\\n at OmniSharp.Roslyn.CSharp.Services.Refactoring.GetFixAllCodeActionService.<Handle>b__1_1(IGrouping`2 grouping) in D:\\\\a\\\\1\\\\s\\\\src\\\\OmniSharp.Roslyn.CSharp\\\\Services\\\\Refactoring\\\\GetFixAllCodeActionService.cs:line 47\\r\\n at System.Linq.Enumerable.SelectManySingleSelectorIterator`2.MoveNext()\\r\\n at System.Linq.Lookup`2.Create(IEnumerable`1 source, Func`2 keySelector, IEqualityComparer`1 comparer)\\r\\n at System.Linq.GroupedEnumerable`2.GetEnumerator()\\r\\n at System.Linq.Enumerable.SelectEnumerableIterator`2.ToArray()\\r\\n at System.Linq.Buffer`1..ctor(IEnumerable`1 source)\\r\\n at System.Linq.OrderedEnumerable`1.ToArray()\\r\\n at OmniSharp.Roslyn.CSharp.Services.Refactoring.GetFixAllCodeActionService.Handle(GetFixAllRequest request) in D:\\\\a\\\\1\\\\s\\\\src\\\\OmniSharp.Roslyn.CSharp\\\\Services\\\\Refactoring\\\\GetFixAllCodeActionService.cs:line 43\\r\\n at OmniSharp.Endpoint.EndpointHandler`2.GetFirstNotEmptyResponseFromHandlers(ExportHandler`2[] handlers, TRequest request)\\r\\n at OmniSharp.Endpoint.EndpointHandler`2.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.EndpointHandler`2.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\\r\\nSystem.TypeLoadException: Access is denied: 'Microsoft.AspNetCore.Razor.PooledObjects.PooledObject`1[System.Collections.Immutable.ImmutableArray`1+Builder[Microsoft.AspNetCore.Razor.Language.SourceMapping]]'.\\r\\nSystem.TypeLoadException: Access is denied: 'Microsoft.AspNetCore.Razor.PooledObjects.PooledObject`1[System.Collections.Immutable.ImmutableArray`1+Builder[Microsoft.AspNetCore.Razor.Language.SourceMapping]]'.\"",
"Body": null,
"Seq": 515,
"Type": "response"
}
Issue Description
Running Fix all occurences and selecting removing all unused usings results in a crash
Steps to Reproduce
CS8019 Remove unused usings
Expected Behavior
Removes all unused references for the whole project
Actual Behavior
Crashes
Logs
OmniSharp log
C# log
N/A [empty]
Environment information
VSCode version: 1.71.1 C# Extension: 1.25.0
Dotnet Information
.NET SDK (reflecting any global.json): Version: 6.0.400 Commit: 7771abd614 Runtime Environment: OS Name: Windows OS Version: 10.0.19044 OS Platform: Windows RID: win10-x64 Base Path: C:\Program Files\dotnet\sdk\6.0.400\ global.json file: Not found Host: Version: 6.0.10 Architecture: x64 Commit: 5a400c212a .NET SDKs installed: 6.1.424 [C:\Program Files\dotnet\sdk] 7.0.403 [C:\Program Files\dotnet\sdk] 6.0.408 [C:\Program Files\dotnet\sdk] 8.0.100 [C:\Program Files\dotnet\sdk] 7.0.110 [C:\Program Files\dotnet\sdk] 6.0.305 [C:\Program Files\dotnet\sdk] 6.0.400 [C:\Program Files\dotnet\sdk] .NET runtimes installed: Microsoft.AspNetCore.App 3.1.21 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 3.1.30 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 5.0.12 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 6.0.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 6.0.10 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.NETCore.App 3.1.21 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 3.1.30 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 5.0.12 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 6.0.8 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 6.0.10 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.WindowsDesktop.App 3.1.21 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 3.1.30 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 5.0.12 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 6.0.6 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 6.0.8 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 6.0.9 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 6.0.10 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Download .NET: https://aka.ms/dotnet-download Learn about .NET Runtimes and SDKs: https://aka.ms/dotnet/runtimes-sdk-infoVisual Studio Code Extensions
|Extension|Author|Version| |---|---|---| |better-toml|bungcip|0.3.2| |Bookmarks|alefragnani|13.3.1| |code-spell-checker|streetsidesoftware|2.10.1| |codesnap|adpyke|1.3.4| |csharp|ms-dotnettools|1.25.0| |docomment|k--kato|0.1.31| |dotnet|leo-labs|1.3.0| |dotnet-interactive-vscode|ms-dotnettools|1.0.3452020| |EditorConfig|EditorConfig|0.16.4| |gc-excelviewer|GrapeCity|4.2.56| |gitlens|eamodio|12.2.2| |go|golang|0.35.2| |jupyter|ms-toolsai|2022.8.1002431955| |jupyter-keymap|ms-toolsai|1.0.0| |jupyter-renderers|ms-toolsai|1.0.9| |markdown-preview-github-styles|bierner|1.0.1| |material-icon-theme|PKief|4.21.0| |powershell-preview|ms-vscode|2022.10.1| |prettier-vscode|esbenp|9.9.0| |python|ms-python|2022.16.1| |rust-analyzer|rust-lang|0.3.1258| |svelte-vscode|svelte|106.2.0| |test-adapter-converter|ms-vscode|0.1.6| |todo-tree|Gruntfuggly|0.0.218| |vsc-community-material-theme|Equinusocio|1.4.4| |vsc-material-theme|Equinusocio|33.5.0| |vsc-material-theme-icons|equinusocio|2.4.0| |vscode-dotnet-adapter|derivitec-ltd|1.4.3| |vscode-dotnet-pack|ms-dotnettools|1.0.9| |vscode-nushell-lang|TheNuProjectContributors|0.7.0| |vscode-pylance|ms-python|2022.10.30| |vscode-solution-explorer|fernandoescolar|0.7.3| |vscode-test-explorer|hbenl|2.21.1| |vscode-test-explorer-liveshare|hbenl|1.0.5| |vscode-todo-highlight|wayou|1.0.5| |vscode-xml|redhat|0.22.0| |vsliveshare|ms-vsliveshare|1.0.5750| |xml|DotJoshJohnson|2.5.1|;