OmniSharp / omnisharp-roslyn

OmniSharp server (HTTP, STDIO) based on Roslyn workspaces
MIT License
1.79k stars 420 forks source link

Omnisharp stops working afeter upgrading Microsoft.CodeAnalysis.CSharp 4.9 -> 4.10 #2629

Open mrgleba opened 3 months ago

mrgleba commented 3 months ago

After upgrading Microsoft.CodeAnalysis.CSharp from 4.9 to 4.10 in my source generator project Omnisharp braks with:

System.Reflection.ReflectionTypeLoadException: Unable to load one or more of the requested types.
Could not load file or assembly 'Microsoft.CodeAnalysis, Version=4.10.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. The system cannot find the file specified.
Could not load file or assembly 'Microsoft.CodeAnalysis, Version=4.10.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. The system cannot find the file specified.
Could not load file or assembly 'Microsoft.CodeAnalysis, Version=4.10.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. The system cannot find the file specified.
Could not load file or assembly 'Microsoft.CodeAnalysis, Version=4.10.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. The system cannot find the file specified.
Could not load file or assembly 'Microsoft.CodeAnalysis, Version=4.10.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. The system cannot find the file specified.
Could not load file or assembly 'Microsoft.CodeAnalysis.CSharp, Version=4.10.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. The system cannot find the file specified.
   at System.Reflection.RuntimeModule.GetTypes(RuntimeModule module)
   at OmniSharp.Roslyn.CSharp.Services.Refactoring.V2.CachingCodeFixProviderForProjects.<>c.<LoadFrom>b__6_0(AnalyzerFileReference analyzerFileReference) in /home/vsts/work/1/s/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 /home/vsts/work/1/s/src/OmniSharp.Roslyn.CSharp/Services/Refactoring/V2/CachingCodeFixProviderForProjects.cs:line 95
   at OmniSharp.Roslyn.CSharp.Services.Refactoring.V2.CachingCodeFixProviderForProjects.GetAllCodeFixesForProject(ProjectId projectId) in /home/vsts/work/1/s/src/OmniSharp.Roslyn.CSharp/Services/Refactoring/V2/CachingCodeFixProviderForProjects.cs:line 57
   at OmniSharp.Roslyn.CSharp.Services.Refactoring.V2.BaseCodeActionService`2.GetSortedCodeFixProviders(Document document) in /home/vsts/work/1/s/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 /home/vsts/work/1/s/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 /home/vsts/work/1/s/src/OmniSharp.Roslyn.CSharp/Services/Refactoring/V2/BaseCodeActionService.cs:line 134
   at OmniSharp.Roslyn.CSharp.Services.Refactoring.V2.BaseCodeActionService`2.GetAvailableCodeActions(ICodeActionRequest request) in /home/vsts/work/1/s/src/OmniSharp.Roslyn.CSharp/Services/Refactoring/V2/BaseCodeActionService.cs:line 86
   at OmniSharp.Roslyn.CSharp.Services.Refactoring.V2.GetCodeActionsService.Handle(GetCodeActionsRequest request) in /home/vsts/work/1/s/src/OmniSharp.Roslyn.CSharp/Services/Refactoring/V2/GetCodeActionsService.cs:line 34
   at OmniSharp.Endpoint.EndpointHandler`2.GetFirstNotEmptyResponseFromHandlers(ExportHandler`2[] handlers, TRequest request) in /home/vsts/work/1/s/src/OmniSharp.Host/Endpoint/EndpointHandler.cs:line 200
   at OmniSharp.Endpoint.EndpointHandler`2.HandleRequestForLanguage(String language, TRequest request, RequestPacket packet) in /home/vsts/work/1/s/src/OmniSharp.Host/Endpoint/EndpointHandler.cs:line 229
   at OmniSharp.Endpoint.EndpointHandler`2.Process(RequestPacket packet, LanguageModel model, JToken requestObject) in /home/vsts/work/1/s/src/OmniSharp.Host/Endpoint/EndpointHandler.cs:line 130
   at OmniSharp.Stdio.Host.HandleRequest(String json, ILogger logger) in /home/vsts/work/1/s/src/OmniSharp.Stdio/Host.cs:line 218
System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.CodeAnalysis, Version=4.10.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. The system cannot find the file specified.
File name: 'Microsoft.CodeAnalysis, Version=4.10.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.CodeAnalysis, Version=4.10.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. The system cannot find the file specified.
File name: 'Microsoft.CodeAnalysis, Version=4.10.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.CodeAnalysis, Version=4.10.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. The system cannot find the file specified.
File name: 'Microsoft.CodeAnalysis, Version=4.10.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.CodeAnalysis, Version=4.10.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. The system cannot find the file specified.
File name: 'Microsoft.CodeAnalysis, Version=4.10.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.CodeAnalysis, Version=4.10.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. The system cannot find the file specified.
File name: 'Microsoft.CodeAnalysis, Version=4.10.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.CodeAnalysis.CSharp, Version=4.10.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. The system cannot find the file specified.
File name: 'Microsoft.CodeAnalysis.CSharp, Version=4.10.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
JoeRobich commented 2 months ago

OmniSharp now uses a prerelease Roslyn version 4.12. Please try with the more recent release.