Skip to content
New issue

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

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

Already on GitHub? # to your account

Unable to load System.Text.Json.SourceGeneration #2626

Open
eun-infare opened this issue Aug 6, 2024 · 1 comment
Open

Unable to load System.Text.Json.SourceGeneration #2626

eun-infare opened this issue Aug 6, 2024 · 1 comment

Comments

@eun-infare
Copy link

eun-infare commented Aug 6, 2024

In some cases when trying to list code actions in Neovim I do not get anything as if there isn't anything to fix. However, the response I get from the server is an error with a stack trace:

 ---> System.IO.FileNotFoundException: Could not load file or assembly 'System.Text.Json.SourceGeneration, Version=8.0.9.8001, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the file specified.
File name: 'System.Text.Json.SourceGeneration, Version=8.0.9.8001, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'
   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)
   at System.Reflection.RuntimeAssembly.InternalLoad(AssemblyName assemblyName, StackCrawlMark& stackMark, AssemblyLoadContext assemblyLoadContext, RuntimeAssembly requestingAssembly, Boolean throwOnFileNotFound)
   at System.Reflection.Assembly.Load(AssemblyName assemblyRef)
   at System.AppDomain.Load(AssemblyName assemblyRef)
   at Microsoft.CodeAnalysis.AnalyzerAssemblyLoader.Load(AssemblyName assemblyName, String assemblyOriginalPath)
   at Microsoft.CodeAnalysis.AnalyzerAssemblyLoader.LoadFromPath(String originalAnalyzerPath)
   --- End of inner exception stack trace ---
   at Microsoft.CodeAnalysis.AnalyzerAssemblyLoader.LoadFromPath(String originalAnalyzerPath)
   at Microsoft.CodeAnalysis.Diagnostics.AnalyzerFileReference.GetAssembly()
   at OmniSharp.Roslyn.CSharp.Services.Refactoring.V2.CachingCodeFixProviderForProjects.<>c__DisplayClass6_0.<LoadFrom>b__0(AnalyzerFileReference analyzerFileReference) in C:\\Users\\eun\\git\\omnisharp-roslyn\\src\\OmniSharp.Roslyn.CSharp\\Services\\Refactoring\\V2\\CachingCodeFixProviderForProjects.cs:line 64
   at System.Linq.Enumerable.SelectManySingleSelectorIterator`2.MoveNext()
   at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
   at System.Linq.Enumerable.WhereEnumerableIterator`1.MoveNext()
   at System.Collections.Generic.LargeArrayBuilder`1.AddRange(IEnumerable`1 items)
   at System.Collections.Generic.SparseArrayBuilder`1.ReserveOrAdd(IEnumerable`1 items)
   at System.Linq.Enumerable.Concat2Iterator`1.ToArray()
   at System.Collections.Immutable.ImmutableArray.CreateRange[T](IEnumerable`1 items)
   at OmniSharp.Roslyn.CSharp.Services.Refactoring.V2.CachingCodeFixProviderForProjects.LoadFrom(Project project) in C:\\Users\\eun\\git\\omnisharp-roslyn\\src\\OmniSharp.Roslyn.CSharp\\Services\\Refactoring\\V2\\CachingCodeFixProviderForProjects.cs:line 95
   at OmniSharp.Roslyn.CSharp.Services.Refactoring.V2.CachingCodeFixProviderForProjects.GetAllCodeFixesForProject(ProjectId projectId) in C:\\Users\\eun\\git\\omnisharp-roslyn\\src\\OmniSharp.Roslyn.CSharp\\Services\\Refactoring\\V2\\CachingCodeFixProviderForProjects.cs:line 57
   at OmniSharp.Roslyn.CSharp.Services.Refactoring.V2.BaseCodeActionService`2.GetSortedCodeFixProviders(Document document) in C:\\Users\\eun\\git\\omnisharp-roslyn\\src\\OmniSharp.Roslyn.CSharp\\Services\\Refactoring\\V2\\BaseCodeActionService.cs:line 170
   at OmniSharp.Roslyn.CSharp.Services.Refactoring.V2.BaseCodeActionService`2.AppendFixesAsync(Document document, TextSpan span, IEnumerable`1 diagnostics, List`1 codeActions) in C:\\Users\\eun\\git\\omnisharp-roslyn\\src\\OmniSharp.Roslyn.CSharp\\Services\\Refactoring\\V2\\BaseCodeActionService.cs:line 142
   at OmniSharp.Roslyn.CSharp.Services.Refactoring.V2.BaseCodeActionService`2.CollectCodeFixesActions(Document document, TextSpan span, List`1 codeActions) in C:\\Users\\eun\\git\\omnisharp-roslyn\\src\\OmniSharp.Roslyn.CSharp\\Services\\Refactoring\\V2\\BaseCodeActionService.cs:line 134
   at OmniSharp.Roslyn.CSharp.Services.Refactoring.V2.BaseCodeActionService`2.GetAvailableCodeActions(ICodeActionRequest request) in C:\\Users\\eun\\git\\omnisharp-roslyn\\src\\OmniSharp.Roslyn.CSharp\\Services\\Refactoring\\V2\\BaseCodeActionService.cs:line 86
   at OmniSharp.Roslyn.CSharp.Services.Refactoring.V2.GetCodeActionsService.Handle(GetCodeActionsRequest request) in C:\\Users\\eun\\git\\omnisharp-roslyn\\src\\OmniSharp.Roslyn.CSharp\\Services\\Refactoring\\V2\\GetCodeActionsService.cs:line 34
   at OmniSharp.LanguageServerProtocol.Handlers.OmniSharpCodeActionHandler.Handle(CodeActionParams request, CancellationToken cancellationToken) in C:\\Users\\eun\\git\\omnisharp-roslyn\\src\\OmniSharp.LanguageServerProtocol\\Handlers\\OmniSharpCodeActionHandler.cs:line 70
   at OmniSharp.Extensions.LanguageServer.Server.Pipelines.SemanticTokensDeltaPipeline`2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate`1 next)
   at OmniSharp.Extensions.LanguageServer.Server.Pipelines.ResolveCommandPipeline`2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate`1 next)
   at MediatR.Pipeline.RequestPreProcessorBehavior`2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate`1 next)
   at MediatR.Pipeline.RequestPostProcessorBehavior`2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate`1 next)
   at MediatR.Pipeline.RequestExceptionProcessorBehavior`2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate`1 next)
   at MediatR.Pipeline.RequestExceptionProcessorBehavior`2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate`1 next)
   at MediatR.Pipeline.RequestExceptionActionProcessorBehavior`2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate`1 next)
   at MediatR.Pipeline.RequestExceptionActionProcessorBehavior`2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate`1 next)
   at OmniSharp.Extensions.JsonRpc.RequestRouterBase`1.<RouteRequest>g__InnerRoute|7_0(IServiceScopeFactory serviceScopeFactory, Request request, TDescriptor descriptor, Object params, CancellationToken token, ILogger logger)
   at OmniSharp.Extensions.JsonRpc.RequestRouterBase`1.RouteRequest(IRequestDescriptor`1 descriptors, Request request, CancellationToken token)
   at OmniSharp.Extensions.JsonRpc.DefaultRequestInvoker.<>c__DisplayClass10_0.<<RouteRequest>b__5>d.MoveNext()

I installed the language server through Mason and also tried building from source on my Windows machine, same result

@BrunodaSilvaBelo
Copy link

i got the same error but from another exception System.InvalidOperationException: Unable to load System.Text.Json.SourceGeneration using emacs 31 with eglot and omnisharp 1.39.12-2 on archlinux.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants