OmniSharp / omnisharp-vim

Vim omnicompletion (intellisense) and more for C#
http://www.omnisharp.net
MIT License
1.72k stars 168 forks source link

Method Not Found: GetFileName #803

Closed rcmosher closed 2 years ago

rcmosher commented 2 years ago

I get the following error for all project files when using omnisharp-vim.

Failed to load project file 'C:\...csproj'.
System.MissingMethodException: Method not found: 'System.ReadOnlySpan`1<Char> Microsoft.IO.Path.GetFileName(System.ReadOnlySpan`1<Char>)'.

I tried adding let g:OmniSharp_server_use_net6 = 1 as resolved this similar issue, but it had no effect. Though I wouldn't be surprise if I missed some additional steps needed for WSL.

These two issues from other projects seem like they might be related. uno issue 9297 docfx issue 8097

WSL 1 dotnet 6.0.400 omnisharp-roslyn 1.39.1

Logs

VIM - Vi IMproved 9.0 (2022 Jun 28, compiled May 10 2022 08:40:37), Included patches: 1-105

OmniSharp server started.
    Path: /mnt/c/Users/person/AppData/Local/omnisharp-vim/omnisharp-rosly/OmniSharp.exe
    Target: /mnt/c/Development/ScrapyCorp/GloboCorp.Thinger/src/GloboCorp.Thinger.sln
    PID: 724

[info]: OmniSharp.Stdio.Host
        Starting OmniSharp on Windows 6.2.9200.0 (x64)
[info]: OmniSharp.Services.DotNetCliService
        Checking the 'DOTNET_ROOT' environment variable to find a .NET SDK
[info]: OmniSharp.Services.DotNetCliService
        Using the 'dotnet' on the PATH.
[info]: OmniSharp.Services.DotNetCliService
        DotNetPath set to dotnet
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Located 2 MSBuild instance(s)
            1: Visual Studio Professional 2022 17.3.32819.101 17.3.1 - "C:\Program Files\Microsoft Visual Studio\2022\Professional\MSBuild\Current\Bin"
            2: Visual Studio Professional 2019 16.11.32002.261 16.11.2 - "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Current\Bin"
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Registered MSBuild instance: Visual Studio Professional 2022 17.3.32819.101 17.3.1 - "C:\Program Files\Microsoft Visual Studio\2022\Professional\MSBuild\Current\Bin"
[info]: OmniSharp.WorkspaceInitializer
        Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.CSharpFormattingWorkspaceOptionsProvider, Order: 0
[info]: OmniSharp.Cake.CakeProjectSystem
        Detecting Cake files in 'C:\Development\ScrapyCorp\GloboCorp.Thinger\src'.
[info]: OmniSharp.Cake.CakeProjectSystem
        Did not find any Cake files
[info]: OmniSharp.MSBuild.ProjectSystem
        Detecting projects in 'C:\Development\ScrapyCorp\GloboCorp.Thinger\src\GloboCorp.Thinger.sln'.
[info]: OmniSharp.MSBuild.ProjectManager
        Queue project update for 'C:\Development\ScrapyCorp\GloboCorp.Thinger\src\GloboCorp.Thinger.Data\GloboCorp.Thinger.Data.csproj'
[info]: OmniSharp.MSBuild.ProjectManager
        Queue project update for 'C:\Development\ScrapyCorp\GloboCorp.Thinger\src\GloboCorp.Thinger.Logic\GloboCorp.Thinger.Logic.csproj'
[info]: OmniSharp.MSBuild.ProjectManager
        Queue project update for 'C:\Development\ScrapyCorp\GloboCorp.Thinger\src\GloboCorp.Thinger.Private.Api\GloboCorp.Thinger.Private.Api.csproj'
[info]: OmniSharp.MSBuild.ProjectManager
        Queue project update for 'C:\Development\ScrapyCorp\GloboCorp.Thinger\src\GloboCorp.Thinger.UnitTests\GloboCorp.Thinger.Logic.UnitTests.csproj'
[info]: OmniSharp.MSBuild.ProjectManager
        Queue project update for 'C:\Development\ScrapyCorp\GloboCorp.Thinger\src\SDK\DotNet\GloboCorp.Thinger.Private.Api.Client\GloboCorp.Thinger.Private.Api.Client.csproj'
[info]: OmniSharp.MSBuild.ProjectManager
        Queue project update for 'C:\Development\ScrapyCorp\GloboCorp.Thinger\src\SDK\DotNet\GloboCorp.Thinger.Public.Api.Client\GloboCorp.Thinger.Public.Api.Client.csproj'
[info]: OmniSharp.MSBuild.ProjectManager
        Queue project update for 'C:\Development\ScrapyCorp\GloboCorp.Thinger\src\GloboCorp.Thinger.Database\GloboCorp.Thinger.Database.csproj'
[info]: OmniSharp.MSBuild.ProjectManager
        Queue project update for 'C:\Development\ScrapyCorp\GloboCorp.Thinger\src\GloboCorp.Thinger.Internal.Messages\GloboCorp.Thinger.Internal.Messages.csproj'
[info]: OmniSharp.MSBuild.ProjectManager
        Queue project update for 'C:\Development\ScrapyCorp\GloboCorp.Thinger\src\GloboCorp.Thinger.Internal.Worker\GloboCorp.Thinger.Internal.Worker.csproj'
[info]: OmniSharp.MSBuild.ProjectManager
        Queue project update for 'C:\Development\ScrapyCorp\GloboCorp.Thinger\src\GloboCorp.Thinger.Internal.Worker.Logic\GloboCorp.Thinger.Internal.Worker.Logic.csproj'
[info]: OmniSharp.MSBuild.ProjectManager
        Queue project update for 'C:\Development\ScrapyCorp\GloboCorp.Thinger\src\GloboCorp.Thinger.Internal.Worker.Logic.UnitTests\GloboCorp.Thinger.Internal.Worker.Logic.UnitTests.csproj'
[info]: OmniSharp.MSBuild.ProjectManager
        Queue project update for 'C:\Development\ScrapyCorp\GloboCorp.Thinger\src\GloboCorp.Thinger.Public.Api.UnitTests\GloboCorp.Thinger.Public.Api.UnitTests.csproj'
[info]: OmniSharp.MSBuild.ProjectManager
        Queue project update for 'C:\Development\ScrapyCorp\GloboCorp.Thinger\src\GloboCorp.Thinger.Nucleus.Worker\GloboCorp.Thinger.Nucleus.Worker.csproj'
[info]: OmniSharp.MSBuild.ProjectManager
        Queue project update for 'C:\Development\ScrapyCorp\GloboCorp.Thinger\src\GloboCorp.Thinger.Nucleus.Worker.Logic\GloboCorp.Thinger.Nucleus.Worker.Logic.csproj'
[info]: OmniSharp.MSBuild.ProjectManager
        Queue project update for 'C:\Development\ScrapyCorp\GloboCorp.Thinger\src\SDK\DotNet\GloboCorp.Thinger.Nucleus.Messages\GloboCorp.Thinger.Nucleus.Messages.csproj'
[info]: OmniSharp.MSBuild.ProjectManager
        Queue project update for 'C:\Development\ScrapyCorp\GloboCorp.Thinger\src\GloboCorp.Thinger.Public.Api\GloboCorp.Thinger.Public.Api.csproj'
[info]: OmniSharp.MSBuild.ProjectManager
        Queue project update for 'C:\Development\ScrapyCorp\GloboCorp.Thinger\src\SDK\GloboCorp.Thinger.Example.Client.Console\GloboCorp.Thinger.Example.Client.Console.csproj'
[info]: OmniSharp.MSBuild.ProjectManager
        Queue project update for 'C:\Development\ScrapyCorp\GloboCorp.Thinger\src\GloboCorp.Thinger.Data.IntegrationTests\GloboCorp.Thinger.Data.IntegrationTests.csproj'
[info]: OmniSharp.MSBuild.ProjectManager
        Queue project update for 'C:\Development\ScrapyCorp\GloboCorp.Thinger\src\GloboCorp.Thinger.Logic.IntegrationTests\GloboCorp.Thinger.Logic.IntegrationTests.csproj'
[info]: OmniSharp.MSBuild.ProjectManager
        Queue project update for 'C:\Development\ScrapyCorp\GloboCorp.Thinger\src\GloboCorp.Thinger.Common.Tests\GloboCorp.Thinger.Common.Tests.csproj'
[info]: OmniSharp.MSBuild.ProjectManager
        Queue project update for 'C:\Development\ScrapyCorp\GloboCorp.Thinger\src\GloboCorp.Thinger.Internal.Worker.Logic.IntegrationTests\GloboCorp.Thinger.Internal.Worker.Logic.IntegrationTests.csproj'
[info]: OmniSharp.MSBuild.ProjectManager
        Queue project update for 'C:\Development\ScrapyCorp\GloboCorp.Thinger\src\GloboCorp.Thinger.Scheduler\GloboCorp.Thinger.Scheduler.csproj'
[info]: OmniSharp.MSBuild.ProjectManager
        Queue project update for 'C:\Development\ScrapyCorp\GloboCorp.Thinger\src\GloboCorp.Thinger.Scheduler.UnitTests\GloboCorp.Thinger.Scheduler.UnitTests.csproj'
[info]: OmniSharp.MSBuild.ProjectManager
        Queue project update for 'C:\Development\ScrapyCorp\GloboCorp.Thinger\src\GloboCorp.Thinger.Scheduler.IntegrationTests\GloboCorp.Thinger.Scheduler.IntegrationTests.csproj'
[info]: OmniSharp.MSBuild.ProjectManager
        Queue project update for 'C:\Development\ScrapyCorp\GloboCorp.Thinger\src\SDK\GloboCorp.Thinger.Abstractions\GloboCorp.Thinger.Abstractions.csproj'
[info]: OmniSharp.MSBuild.ProjectManager
        Queue project update for 'C:\Development\ScrapyCorp\GloboCorp.Thinger\src\SDK\GloboCorp.Thinger.Autofac\GloboCorp.Thinger.Autofac.csproj'
[info]: OmniSharp.MSBuild.ProjectManager
        Queue project update for 'C:\Development\ScrapyCorp\GloboCorp.Thinger\src\GloboCorp.Thinger.Example.Api.AspNetCore\GloboCorp.Thinger.Example.Api.AspNetCore.csproj'
[info]: OmniSharp.MSBuild.ProjectManager
        Queue project update for 'C:\Development\ScrapyCorp\GloboCorp.Thinger\src\GloboCorp.Thinger.Common\GloboCorp.Thinger.Common.csproj'
[info]: OmniSharp.MSBuild.ProjectManager
        Queue project update for 'C:\Development\ScrapyCorp\GloboCorp.Thinger\src\GloboCorp.Thinger.Nucleus.Worker.Logic.UnitTests\GloboCorp.Thinger.Nucleus.Worker.Logic.UnitTests.csproj'
[info]: OmniSharp.MSBuild.ProjectManager
        Queue project update for 'C:\Development\ScrapyCorp\GloboCorp.Thinger\src\GloboCorp.Thinger.Nucleus.Worker.Logic.IntegrationTests\GloboCorp.Thinger.Nucleus.Worker.Logic.IntegrationTests.csproj'
[info]: OmniSharp.MSBuild.ProjectManager
        Queue project update for 'C:\Development\ScrapyCorp\GloboCorp.Thinger\src\GloboCorp.Thinger.Data.UnitTests\GloboCorp.Thinger.Data.UnitTests.csproj'
[info]: OmniSharp.Script.ScriptProjectSystem
        Detecting CSX files in 'C:\Development\ScrapyCorp\GloboCorp.Thinger\src'.
[info]: OmniSharp.Script.ScriptProjectSystem
        Did not find any CSX files
[info]: OmniSharp.WorkspaceInitializer
        Configuration finished.
[info]: OmniSharp.Stdio.Host
        Omnisharp server running using Stdio at location 'C:\Development\ScrapyCorp\GloboCorp.Thinger\src' on host -1.
[info]: OmniSharp.MSBuild.ProjectManager
        Loading project: C:\Development\ScrapyCorp\GloboCorp.Thinger\src\GloboCorp.Thinger.Data\GloboCorp.Thinger.Data.csproj
[info]: OmniSharp.OmniSharpWorkspace
        Miscellaneous file: C:\Development\ScrapyCorp\GloboCorp.Thinger\src\GloboCorp.Thinger.Internal.Worker.Logic.UnitTests\Areas\Role\Consumers\RoleConsumerTests.cs added to workspace
Replaying requests for buffer 1
[fail]: OmniSharp.MSBuild.ProjectManager
        Failed to load project file 'C:\Development\ScrapyCorp\GloboCorp.Thinger\src\GloboCorp.Thinger.Data\GloboCorp.Thinger.Data.csproj'.
System.MissingMethodException: Method not found: 'System.ReadOnlySpan`1<Char> Microsoft.IO.Path.GetFileName(System.ReadOnlySpan`1<Char>)'.
   at Microsoft.Build.Shared.FileMatcher.IsFileNameMatch(String path, String pattern)
   at System.Linq.Enumerable.WhereArrayIterator`1.MoveNext()
   at System.Linq.Buffer`1..ctor(IEnumerable`1 source)
   at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
   at Microsoft.Build.Shared.FileMatcher.GetFilesForStep(RecursiveStepResult stepResult, RecursionState recursionState, String projectDirectory, Boolean stripProjectDirectory)
   at Microsoft.Build.Shared.FileMatcher.GetFilesRecursive(ConcurrentStack`1 listOfFiles, RecursionState recursionState, String projectDirectory, Boolean stripProjectDirectory, IList`1 searchesToExclude, Dictionary`2 searchesToExcludeInSubdirs, TaskOptions taskOptions)
   at Microsoft.Build.Shared.FileMatcher.GetFilesImplementation(String projectDirectoryUnescaped, String filespecUnescaped, List`1 excludeSpecsUnescaped)
   at Microsoft.Build.Shared.FileMatcher.<>c__DisplayClass67_0.<GetFiles>b__1(String _)
   at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory)
   at Microsoft.Build.Shared.FileMatcher.GetFiles(String projectDirectoryUnescaped, String filespecUnescaped, List`1 excludeSpecsUnescaped)
   at Microsoft.Build.Internal.EngineFileUtilities.GetFileList(String directoryEscaped, String filespecEscaped, Boolean returnEscaped, Boolean forceEvaluateWildCards, IEnumerable`1 excludeSpecsEscaped, FileMatcher fileMatcher, Object loggingMechanism, IElementLocation includeLocation, IElementLocation excludeLocation, IElementLocation importLocation, BuildEventContext buildEventContext, String buildEventFileInfoFullPath, Boolean disableExcludeDriveEnumerationWarning)
   at Microsoft.Build.Internal.EngineFileUtilities.GetFileListEscaped(String directoryEscaped, String filespecEscaped, IEnumerable`1 excludeSpecsEscaped, Boolean forceEvaluate, FileMatcher fileMatcher, Object loggingMechanism, IElementLocation includeLocation, IElementLocation excludeLocation, IElementLocation importLocation, BuildEventContext buildEventContext, String buildEventFileInfoFullPath, Boolean disableExcludeDriveEnumerationWarning)
   at Microsoft.Build.Evaluation.Evaluator`4.ExpandAndLoadImportsFromUnescapedImportExpression(String directoryOfImportingFile, ProjectImportElement importElement, String unescapedExpression, Boolean throwOnFileNotExistsError, List`1& imports)
   at Microsoft.Build.Evaluation.Evaluator`4.ExpandAndLoadImportsFromUnescapedImportExpressionConditioned(String directoryOfImportingFile, ProjectImportElement importElement, List`1& projects, SdkResult& sdkResult, Boolean throwOnFileNotExistsError)
   at Microsoft.Build.Evaluation.Evaluator`4.ExpandAndLoadImports(String directoryOfImportingFile, ProjectImportElement importElement, SdkResult& sdkResult)
   at Microsoft.Build.Evaluation.Evaluator`4.EvaluateImportElement(String directoryOfImportingFile, ProjectImportElement importElement)
   at Microsoft.Build.Evaluation.Evaluator`4.PerformDepthFirstPass(ProjectRootElement currentProjectOrImport)
   at Microsoft.Build.Evaluation.Evaluator`4.EvaluateImportElement(String directoryOfImportingFile, ProjectImportElement importElement)
   at Microsoft.Build.Evaluation.Evaluator`4.PerformDepthFirstPass(ProjectRootElement currentProjectOrImport)
   at Microsoft.Build.Evaluation.Evaluator`4.EvaluateImportElement(String directoryOfImportingFile, ProjectImportElement importElement)
   at Microsoft.Build.Evaluation.Evaluator`4.PerformDepthFirstPass(ProjectRootElement currentProjectOrImport)
   at Microsoft.Build.Evaluation.Evaluator`4.Evaluate()
   at Microsoft.Build.Evaluation.Evaluator`4.Evaluate(IEvaluatorData`4 data, Project project, ProjectRootElement root, ProjectLoadSettings loadSettings, Int32 maxNodeCount, PropertyDictionary`1 environmentProperties, ILoggingService loggingService, IItemFactory`2 itemFactory, IToolsetProvider toolsetProvider, ProjectRootElementCacheBase projectRootElementCache, BuildEventContext buildEventContext, ISdkResolverService sdkResolverService, Int32 submissionId, EvaluationContext evaluationContext, Boolean interactive)
   at Microsoft.Build.Evaluation.Project.ProjectImpl.Reevaluate(ILoggingService loggingServiceForEvaluation, ProjectLoadSettings loadSettings, EvaluationContext evaluationContext)
   at Microsoft.Build.Evaluation.Project.ProjectImpl.ReevaluateIfNecessary(ILoggingService loggingServiceForEvaluation, ProjectLoadSettings loadSettings, EvaluationContext evaluationContext)
   at Microsoft.Build.Evaluation.Project.ProjectImpl.ReevaluateIfNecessary(EvaluationContext evaluationContext)
   at Microsoft.Build.Evaluation.Project.ProjectImpl.Initialize(IDictionary`2 globalProperties, String toolsVersion, String subToolsetVersion, ProjectLoadSettings loadSettings, EvaluationContext evaluationContext)
   at Microsoft.Build.Evaluation.Project..ctor(String projectFile, IDictionary`2 globalProperties, String toolsVersion, String subToolsetVersion, ProjectCollection projectCollection, ProjectLoadSettings loadSettings, EvaluationContext evaluationContext, IDirectoryCacheFactory directoryCacheFactory)
   at Microsoft.Build.Evaluation.ProjectCollection.LoadProject(String fileName, IDictionary`2 globalProperties, String toolsVersion)
   at OmniSharp.MSBuild.ProjectLoader.EvaluateProjectFileCore(String filePath, IReadOnlyDictionary`2 projectConfigurationsInSolution, IList`1 loggers) in D:\a\1\s\src\OmniSharp.MSBuild\ProjectLoader.cs:line 160
   at OmniSharp.MSBuild.ProjectLoader.BuildProject(String filePath, IReadOnlyDictionary`2 configurationsInSolution) in D:\a\1\s\src\OmniSharp.MSBuild\ProjectLoader.cs:line 84
   at OmniSharp.MSBuild.ProjectFile.ProjectFileInfo.Load(String filePath, ProjectIdInfo projectIdInfo, ProjectLoader loader, Guid sessionId, DotNetInfo dotNetInfo) in D:\a\1\s\src\OmniSharp.MSBuild\ProjectFile\ProjectFileInfo.cs:line 117
   at OmniSharp.MSBuild.ProjectManager.<>c__DisplayClass32_0.<LoadProject>b__0() in D:\a\1\s\src\OmniSharp.MSBuild\ProjectManager.cs:line 305
   at OmniSharp.MSBuild.ProjectManager.LoadOrReloadProject(String projectFilePath, Func`1 loader) in D:\a\1\s\src\OmniSharp.MSBuild\ProjectManager.cs:line 316
[info]: OmniSharp.MSBuild.ProjectManager
        Loading project: C:\Development\ScrapyCorp\GloboCorp.Thinger\src\GloboCorp.Thinger.Logic\GloboCorp.Thinger.Logic.csproj
[fail]: OmniSharp.MSBuild.ProjectManager
        Failed to load project file 'C:\Development\ScrapyCorp\GloboCorp.Thinger\src\GloboCorp.Thinger.Logic\GloboCorp.Thinger.Logic.csproj'.
System.MissingMethodException: Method not found: 'System.ReadOnlySpan`1<Char> Microsoft.IO.Path.GetFileName(System.ReadOnlySpan`1<Char>)'.
   at Microsoft.Build.Shared.FileMatcher.IsFileNameMatch(String path, String pattern)
   at System.Linq.Enumerable.WhereArrayIterator`1.MoveNext()
   at System.Linq.Buffer`1..ctor(IEnumerable`1 source)
   at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
   at Microsoft.Build.Shared.FileMatcher.GetFilesForStep(RecursiveStepResult stepResult, RecursionState recursionState, String projectDirectory, Boolean stripProjectDirectory)
   at Microsoft.Build.Shared.FileMatcher.GetFilesRecursive(ConcurrentStack`1 listOfFiles, RecursionState recursionState, String projectDirectory, Boolean stripProjectDirectory, IList`1 searchesToExclude, Dictionary`2 searchesToExcludeInSubdirs, TaskOptions taskOptions)
   at Microsoft.Build.Shared.FileMatcher.GetFilesImplementation(String projectDirectoryUnescaped, String filespecUnescaped, List`1 excludeSpecsUnescaped)
   at Microsoft.Build.Shared.FileMatcher.<>c__DisplayClass67_0.<GetFiles>b__1(String _)
   at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory)
   at Microsoft.Build.Shared.FileMatcher.GetFiles(String projectDirectoryUnescaped, String filespecUnescaped, List`1 excludeSpecsUnescaped)
   at Microsoft.Build.Internal.EngineFileUtilities.GetFileList(String directoryEscaped, String filespecEscaped, Boolean returnEscaped, Boolean forceEvaluateWildCards, IEnumerable`1 excludeSpecsEscaped, FileMatcher fileMatcher, Object loggingMechanism, IElementLocation includeLocation, IElementLocation excludeLocation, IElementLocation importLocation, BuildEventContext buildEventContext, String buildEventFileInfoFullPath, Boolean disableExcludeDriveEnumerationWarning)
   at Microsoft.Build.Internal.EngineFileUtilities.GetFileListEscaped(String directoryEscaped, String filespecEscaped, IEnumerable`1 excludeSpecsEscaped, Boolean forceEvaluate, FileMatcher fileMatcher, Object loggingMechanism, IElementLocation includeLocation, IElementLocation excludeLocation, IElementLocation importLocation, BuildEventContext buildEventContext, String buildEventFileInfoFullPath, Boolean disableExcludeDriveEnumerationWarning)
   at Microsoft.Build.Evaluation.Evaluator`4.ExpandAndLoadImportsFromUnescapedImportExpression(String directoryOfImportingFile, ProjectImportElement importElement, String unescapedExpression, Boolean throwOnFileNotExistsError, List`1& imports)
   at Microsoft.Build.Evaluation.Evaluator`4.ExpandAndLoadImportsFromUnescapedImportExpressionConditioned(String directoryOfImportingFile, ProjectImportElement importElement, List`1& projects, SdkResult& sdkResult, Boolean throwOnFileNotExistsError)
   at Microsoft.Build.Evaluation.Evaluator`4.ExpandAndLoadImports(String directoryOfImportingFile, ProjectImportElement importElement, SdkResult& sdkResult)
   at Microsoft.Build.Evaluation.Evaluator`4.EvaluateImportElement(String directoryOfImportingFile, ProjectImportElement importElement)
   at Microsoft.Build.Evaluation.Evaluator`4.PerformDepthFirstPass(ProjectRootElement currentProjectOrImport)
   at Microsoft.Build.Evaluation.Evaluator`4.EvaluateImportElement(String directoryOfImportingFile, ProjectImportElement importElement)
   at Microsoft.Build.Evaluation.Evaluator`4.PerformDepthFirstPass(ProjectRootElement currentProjectOrImport)
   at Microsoft.Build.Evaluation.Evaluator`4.EvaluateImportElement(String directoryOfImportingFile, ProjectImportElement importElement)
   at Microsoft.Build.Evaluation.Evaluator`4.PerformDepthFirstPass(ProjectRootElement currentProjectOrImport)
   at Microsoft.Build.Evaluation.Evaluator`4.Evaluate()
   at Microsoft.Build.Evaluation.Evaluator`4.Evaluate(IEvaluatorData`4 data, Project project, ProjectRootElement root, ProjectLoadSettings loadSettings, Int32 maxNodeCount, PropertyDictionary`1 environmentProperties, ILoggingService loggingService, IItemFactory`2 itemFactory, IToolsetProvider toolsetProvider, ProjectRootElementCacheBase projectRootElementCache, BuildEventContext buildEventContext, ISdkResolverService sdkResolverService, Int32 submissionId, EvaluationContext evaluationContext, Boolean interactive)
   at Microsoft.Build.Evaluation.Project.ProjectImpl.Reevaluate(ILoggingService loggingServiceForEvaluation, ProjectLoadSettings loadSettings, EvaluationContext evaluationContext)
   at Microsoft.Build.Evaluation.Project.ProjectImpl.ReevaluateIfNecessary(ILoggingService loggingServiceForEvaluation, ProjectLoadSettings loadSettings, EvaluationContext evaluationContext)
   at Microsoft.Build.Evaluation.Project.ProjectImpl.ReevaluateIfNecessary(EvaluationContext evaluationContext)
   at Microsoft.Build.Evaluation.Project.ProjectImpl.Initialize(IDictionary`2 globalProperties, String toolsVersion, String subToolsetVersion, ProjectLoadSettings loadSettings, EvaluationContext evaluationContext)
   at Microsoft.Build.Evaluation.Project..ctor(String projectFile, IDictionary`2 globalProperties, String toolsVersion, String subToolsetVersion, ProjectCollection projectCollection, ProjectLoadSettings loadSettings, EvaluationContext evaluationContext, IDirectoryCacheFactory directoryCacheFactory)
   at Microsoft.Build.Evaluation.ProjectCollection.LoadProject(String fileName, IDictionary`2 globalProperties, String toolsVersion)
   at OmniSharp.MSBuild.ProjectLoader.EvaluateProjectFileCore(String filePath, IReadOnlyDictionary`2 projectConfigurationsInSolution, IList`1 loggers) in D:\a\1\s\src\OmniSharp.MSBuild\ProjectLoader.cs:line 160
   at OmniSharp.MSBuild.ProjectLoader.BuildProject(String filePath, IReadOnlyDictionary`2 configurationsInSolution) in D:\a\1\s\src\OmniSharp.MSBuild\ProjectLoader.cs:line 84
   at OmniSharp.MSBuild.ProjectFile.ProjectFileInfo.Load(String filePath, ProjectIdInfo projectIdInfo, ProjectLoader loader, Guid sessionId, DotNetInfo dotNetInfo) in D:\a\1\s\src\OmniSharp.MSBuild\ProjectFile\ProjectFileInfo.cs:line 117
   at OmniSharp.MSBuild.ProjectManager.<>c__DisplayClass32_0.<LoadProject>b__0() in D:\a\1\s\src\OmniSharp.MSBuild\ProjectManager.cs:line 305
   at OmniSharp.MSBuild.ProjectManager.LoadOrReloadProject(String projectFilePath, Func`1 loader) in D:\a\1\s\src\OmniSharp.MSBuild\ProjectManager.cs:line 316
[info]: OmniSharp.MSBuild.ProjectManager
        Loading project: C:\Development\ScrapyCorp\GloboCorp.Thinger\src\GloboCorp.Thinger.Private.Api\GloboCorp.Thinger.Private.Api.csproj

full log file

nickspoons commented 2 years ago

This is a server issue. There's a PR for a fix in place here: https://github.com/OmniSharp/omnisharp-roslyn/pull/2443

rcmosher commented 2 years ago

I installed omnisharp-roslyn v1.39.2-beta.10 (using a modified omnisharp-manager.sh) and I'm still getting the same errors. I'll do a little more digging and post in the omnisharp-roslyn project. But it looks like the latest beta doesn't fix this.

rcmosher commented 2 years ago

I tried a few things to resolve this after the above. I updated Visual Studio 2022 which did not resolve the issue. Then I ran :OmniSharpInstall from gVim in Windows instead of WSL and it started working. I'm a little surprised OmniSharp in WSL knew to use the Windows install since WSL installed to omnisharp-rosly and Windows to omnisharp-roslyn.

Looking at logs in ~/vimfiles/plugged/omnisharp-vim/log/ there's some obvious differences in what is being referenced. When working it's referencing .Net Core SDK, and when broken it's referencing Visual Studio. Also surprising is the Windows version change from 6.2.9200.0 to 10.0.19044.0. Not sure what that version means but I did not upgrade Windows. LOL.

Broken Log

VIM - Vi IMproved 9.0 (2022 Jun 28, compiled May 10 2022 08:40:37), Included patches: 1-105

OmniSharp server started.
    Path: /mnt/c/Users/me/AppData/Local/omnisharp-vim/omnisharp-rosly/OmniSharp.exe
    Target: /mnt/c/Development/ScrappyCorp/GloboCorp.Project/src/GloboCorp.Project.sln
    PID: 31909

[info]: OmniSharp.Stdio.Host
        Starting OmniSharp on Windows 6.2.9200.0 (x64)
[info]: OmniSharp.Services.DotNetCliService
        Checking the 'DOTNET_ROOT' environment variable to find a .NET SDK
[info]: OmniSharp.Services.DotNetCliService
        Using the 'dotnet' on the PATH.
[info]: OmniSharp.Services.DotNetCliService
        DotNetPath set to dotnet
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Located 2 MSBuild instance(s)
            1: Visual Studio Professional 2022 17.3.32819.101 17.3.1 - "C:\Program Files\Microsoft Visual Studio\2022\Professional\MSBuild\Current\Bin"
            2: Visual Studio Professional 2019 16.11.32002.261 16.11.2 - "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Current\Bin"
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Registered MSBuild instance: Visual Studio Professional 2022 17.3.32819.101 17.3.1 - "C:\Program Files\Microsoft Visual Studio\2022\Professional\MSBuild\Current\Bin"

Working Log

VIM - Vi IMproved 9.0 (2022 Jun 28, compiled May 10 2022 08:40:37), Included patches: 1-105

OmniSharp server started.
    Path: /mnt/c/Users/me/AppData/Local/omnisharp-vim/omnisharp-roslyn/OmniSharp.exe
    Target: /mnt/c/Development/ScrappyCorp/GloboCorp.Project/src/GloboCorp.Project.sln
    PID: 2583

[info]: OmniSharp.Stdio.Host
        Starting OmniSharp on Windows 10.0.19044.0 (x64)
[info]: OmniSharp.Services.DotNetCliService
        Checking the 'DOTNET_ROOT' environment variable to find a .NET SDK
[info]: OmniSharp.Services.DotNetCliService
        Using the 'dotnet' on the PATH.
[info]: OmniSharp.Services.DotNetCliService
        DotNetPath set to dotnet
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Located 4 MSBuild instance(s)
            1: .NET Core SDK 6.0.402 17.3.2 - "C:\Program Files\dotnet\sdk\6.0.402\"
            2: .NET Core SDK 6.0.304 17.2.0 - "C:\Program Files\dotnet\sdk\6.0.304\"
            3: .NET Core SDK 6.0.109 17.0.0 - "C:\Program Files\dotnet\sdk\6.0.109\"
            4: .NET Core SDK 6.0.100 17.0.0 - "C:\Program Files\dotnet\sdk\6.0.100\"
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Registered MSBuild instance: .NET Core SDK 6.0.402 17.3.2 - "C:\Program Files\dotnet\sdk\6.0.402\"
nickspoons commented 2 years ago

It's hard to be sure from the details you've given but it looks like the "broken" version is using the older. NET Framework build of OmniSharp-roslyn, and the "working" version is using the new net6 build.

rcmosher commented 2 years ago

I did add let g:OmniSharp_server_use_net6 = 1 but I bet since I was doing a manual install of beta I never actually reinstalled, or downloaded the correct zip for net6.