You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using code actions on types that hasn't been imported OmniSharp fails to suggest any options.
Code actions like adding param to constructor works. There seems to be something with imports.
This has worked without problems in the past, up until yesterday. I Updated packages in plugins imported through Lazy and Mason.
I have testet Omnisharp v1.39.12 and v1.39.11, both run into the same problem.
Error message in lsp.log
OmniSharp.Extensions.JsonRpc.DefaultRequestInvoker: Failed to handle request textDocument/codeAction 5 - System.InvalidOperationException: Unable to load Microsoft.Extensions.Logging.Generators\r\n ---> System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.Extensions.Logging.Generators, Version=8.0.10.31311, Culture=neutral, PublicKeyToken=adb9793829ddae60'. Systemet finner ikke angitt fil.\r\nFile name: 'Microsoft.Extensions.Logging.Generators, Version=8.0.10.31311, 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(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.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.WhereSelectEnumerableIterator2.MoveNext()\r\n at System.Linq.Enumerable.WhereEnumerableIterator1.MoveNext()\r\n at System.Collections.Generic.LargeArrayBuilder1.AddRange(IEnumerable1 items)\r\n at System.Collections.Generic.SparseArrayBuilder1.ReserveOrAdd(IEnumerable1 items)\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.LanguageServerProtocol.Handlers.OmniSharpCodeActionHandler.Handle(CodeActionParams request, CancellationToken cancellationToken) in D:\\a\\1\\s\\src\\OmniSharp.LanguageServerProtocol\\Handlers\\OmniSharpCodeActionHandler.cs:line 70\r\n at OmniSharp.Extensions.LanguageServer.Server.Pipelines.SemanticTokensDeltaPipeline2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate1 next)\r\n at OmniSharp.Extensions.LanguageServer.Server.Pipelines.ResolveCommandPipeline2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate1 next)\r\n at MediatR.Pipeline.RequestPreProcessorBehavior2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate1 next)\r\n at MediatR.Pipeline.RequestPostProcessorBehavior2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate1 next)\r\n at MediatR.Pipeline.RequestExceptionProcessorBehavior2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate1 next)\r\n at MediatR.Pipeline.RequestExceptionProcessorBehavior2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate1 next)\r\n at MediatR.Pipeline.RequestExceptionActionProcessorBehavior2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate1 next)\r\n at MediatR.Pipeline.RequestExceptionActionProcessorBehavior2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate1 next)\r\n at OmniSharp.Extensions.JsonRpc.RequestRouterBase1.g__InnerRoute|7_0(IServiceScopeFactory serviceScopeFactory, Request request, TDescriptor descriptor, Object params, CancellationToken token, ILogger logger)\r\n at OmniSharp.Extensions.JsonRpc.RequestRouterBase1.RouteRequest(IRequestDescriptor1 descriptors, Request request, CancellationToken token)\r\n at OmniSharp.Extensions.JsonRpc.DefaultRequestInvoker.<>c__DisplayClass10_0.<b__5>d.MoveNext() | Method='textDocument/codeAction' RequestId='5'
`
I have tried reinstalling everything without luck.
The text was updated successfully, but these errors were encountered:
I'm not sure of the root cause but I have a workaround, at least in my case.
I have a library that has has a ProjectReference and a PackageReference. The ProjectReference has dependency that pulls in Microsoft.Extensions.Logging 8.0.0 while the PackageReference depends on Microsoft.Extensions.Logging.Abstractions 8.0.1.
Explicitly adding a dependency on Microsoft.Extensions.Logging.Abstractions 8.0.1 in the ProjectReference seems to fix this problem.
When using code actions on types that hasn't been imported OmniSharp fails to suggest any options.
Code actions like adding param to constructor works. There seems to be something with imports.
This has worked without problems in the past, up until yesterday. I Updated packages in plugins imported through Lazy and Mason.
I have testet Omnisharp v1.39.12 and v1.39.11, both run into the same problem.
Error message in lsp.log
OmniSharp.Extensions.JsonRpc.DefaultRequestInvoker: Failed to handle request textDocument/codeAction 5 - System.InvalidOperationException: Unable to load Microsoft.Extensions.Logging.Generators\r\n ---> System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.Extensions.Logging.Generators, Version=8.0.10.31311, Culture=neutral, PublicKeyToken=adb9793829ddae60'. Systemet finner ikke angitt fil.\r\nFile name: 'Microsoft.Extensions.Logging.Generators, Version=8.0.10.31311, 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(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.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.SelectManySingleSelectorIterator
2.MoveNext()\r\n at System.Linq.Enumerable.WhereSelectEnumerableIterator2.MoveNext()\r\n at System.Linq.Enumerable.WhereEnumerableIterator
1.MoveNext()\r\n at System.Collections.Generic.LargeArrayBuilder1.AddRange(IEnumerable
1 items)\r\n at System.Collections.Generic.SparseArrayBuilder1.ReserveOrAdd(IEnumerable
1 items)\r\n at System.Linq.Enumerable.Concat2Iterator1.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.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.BaseCodeActionService
2.AppendFixesAsync(Document document, TextSpan span, IEnumerable1 diagnostics, List
1 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, List
1 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.LanguageServerProtocol.Handlers.OmniSharpCodeActionHandler.Handle(CodeActionParams request, CancellationToken cancellationToken) in D:\\a\\1\\s\\src\\OmniSharp.LanguageServerProtocol\\Handlers\\OmniSharpCodeActionHandler.cs:line 70\r\n at OmniSharp.Extensions.LanguageServer.Server.Pipelines.SemanticTokensDeltaPipeline
2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate1 next)\r\n at OmniSharp.Extensions.LanguageServer.Server.Pipelines.ResolveCommandPipeline
2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate1 next)\r\n at MediatR.Pipeline.RequestPreProcessorBehavior
2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate1 next)\r\n at MediatR.Pipeline.RequestPostProcessorBehavior
2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate1 next)\r\n at MediatR.Pipeline.RequestExceptionProcessorBehavior
2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate1 next)\r\n at MediatR.Pipeline.RequestExceptionProcessorBehavior
2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate1 next)\r\n at MediatR.Pipeline.RequestExceptionActionProcessorBehavior
2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate1 next)\r\n at MediatR.Pipeline.RequestExceptionActionProcessorBehavior
2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate1 next)\r\n at OmniSharp.Extensions.JsonRpc.RequestRouterBase
1.g__InnerRoute|7_0(IServiceScopeFactory serviceScopeFactory, Request request, TDescriptor descriptor, Object params, CancellationToken token, ILogger logger)\r\n at OmniSharp.Extensions.JsonRpc.RequestRouterBase1.RouteRequest(IRequestDescriptor
1 descriptors, Request request, CancellationToken token)\r\n at OmniSharp.Extensions.JsonRpc.DefaultRequestInvoker.<>c__DisplayClass10_0.<b__5>d.MoveNext() | Method='textDocument/codeAction' RequestId='5'`
I have tried reinstalling everything without luck.
The text was updated successfully, but these errors were encountered: