Omnisharp-vscode: csproj file showing The expression ""Program.cs".GetPathsOfAllDirectoriesAbove()" cannot be evaluated.

Created on 6 Nov 2019  路  11Comments  路  Source: OmniSharp/omnisharp-vscode

Issue Description

In a new Dot Net Core 3 console application, the .csproj file is showing an error The expression ""Program.cs".GetPathsOfAllDirectoriesAbove()" cannot be evaluated.

Steps to Reproduce

Create new .NET 3 console application.
Open in VSCode.
Open .csproj file

Expected Behavior

No errors

Actual Behavior

Error at end of file:
image

Logs

OmniSharp log


Starting OmniSharp server at 11/6/2019, 9:59:26 AM
Target: /Users/johntsombakos/Projects/WorkflowStatus/WorkflowStatus.sln

OmniSharp server started with Mono 6.6.0.
Path: /Users/johntsombakos/.vscode-insiders/extensions/ms-vscode.csharp-1.21.6/.omnisharp/1.34.6/omnisharp/OmniSharp.exe
PID: 99757

    Starting OmniSharp on MacOS 10.15.1 (x64)
    DotNetPath set to dotnet
    Located 2 MSBuild instance(s)
        1: Mono 16.3 - "/Library/Frameworks/Mono.framework/Versions/6.6.0/lib/mono/msbuild/Current/bin"
        2: StandAlone 16.3 - "/Users/johntsombakos/.vscode-insiders/extensions/ms-vscode.csharp-1.21.6/.omnisharp/1.34.6/omnisharp/.msbuild/Current/Bin"
    Registered MSBuild instance: Mono 16.3 - "/Library/Frameworks/Mono.framework/Versions/6.6.0/lib/mono/msbuild/Current/bin"
        CscToolExe = csc.exe
        CscToolPath = /Users/johntsombakos/.vscode-insiders/extensions/ms-vscode.csharp-1.21.6/.omnisharp/1.34.6/omnisharp/.msbuild/Current/Bin/Roslyn
    Detecting Cake files in '/Users/johntsombakos/Projects/WorkflowStatus'.
    Could not find any Cake files
    Detecting projects in '/Users/johntsombakos/Projects/WorkflowStatus/WorkflowStatus.sln'.
    Queue project update for '/Users/johntsombakos/Projects/WorkflowStatus/WorkflowStatus/WorkflowStatus.csproj'
    Detecting CSX files in '/Users/johntsombakos/Projects/WorkflowStatus'.
    Could not find any CSX files
    Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.CSharpFormattingWorkspaceOptionsProvider, Order: 0
    Loading project: /Users/johntsombakos/Projects/WorkflowStatus/WorkflowStatus/WorkflowStatus.csproj
    Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.RenameWorkspaceOptionsProvider, Order: 100
    Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.EditorConfigWorkspaceOptionsProvider, Order: 200
    Configuration finished.
    Omnisharp server running using Stdio at location '/Users/johntsombakos/Projects/WorkflowStatus' on host 99653.
    Successfully loaded project file '/Users/johntsombakos/Projects/WorkflowStatus/WorkflowStatus/WorkflowStatus.csproj'.
    Adding project '/Users/johntsombakos/Projects/WorkflowStatus/WorkflowStatus/WorkflowStatus.csproj'
    Update project: WorkflowStatus
    Solution initialized -> queue all documents for code analysis. Initial document count: 3.

C# log

Empty

Environment information

VSCode version: 1.40.0-insider
C# Extension: 1.21.6

Mono Information
OmniSharp using global mono :6.6.0

Dotnet Information
.NET Core SDK (reflecting any global.json):
Version: 3.1.100-preview2-014569
Commit: 4bd5d24d87

Runtime Environment:
OS Name: Mac OS X
OS Version: 10.15
OS Platform: Darwin
RID: osx.10.15-x64
Base Path: /usr/local/share/dotnet/sdk/3.1.100-preview2-014569/

Host (useful for support):
Version: 3.1.0-preview2.19525.6
Commit: 5672978d91

.NET Core SDKs installed:
2.2.100 [/usr/local/share/dotnet/sdk]
2.2.101 [/usr/local/share/dotnet/sdk]
2.2.103 [/usr/local/share/dotnet/sdk]
2.2.104 [/usr/local/share/dotnet/sdk]
2.2.105 [/usr/local/share/dotnet/sdk]
2.2.106 [/usr/local/share/dotnet/sdk]
2.2.107 [/usr/local/share/dotnet/sdk]
2.2.203 [/usr/local/share/dotnet/sdk]
2.2.300 [/usr/local/share/dotnet/sdk]
2.2.301 [/usr/local/share/dotnet/sdk]
2.2.401 [/usr/local/share/dotnet/sdk]
2.2.402 [/usr/local/share/dotnet/sdk]
3.0.100 [/usr/local/share/dotnet/sdk]
3.1.100-preview2-014569 [/usr/local/share/dotnet/sdk]

.NET Core runtimes installed:
Microsoft.AspNetCore.All 2.2.0 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.2.1 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.2.2 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.2.3 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.2.4 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.2.5 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.2.6 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.2.7 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.12 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.2.0 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.2.1 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.2.2 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.2.3 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.2.4 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.2.5 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.2.6 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.2.7 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.0.0 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.0-preview2.19528.8 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.1.13 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 2.2.0 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 2.2.1 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 2.2.2 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 2.2.3 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 2.2.4 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 2.2.5 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 2.2.6 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 2.2.7 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 3.0.0 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.0-preview2.19525.6 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]

To install additional .NET Core runtimes or SDKs:
https://aka.ms/dotnet-download


Visual Studio Code Extensions

|Extension|Author|Version|
|---|---|---|
|Angular2|johnpapa|8.1.1|
|auto-close-tag|formulahendry|0.5.6|
|azure-account|ms-vscode|0.8.7|
|csharp|ms-vscode|1.21.6|
|debugger-for-chrome|msjsdiag|4.12.1|
|githistory|donjayamanne|0.4.6|
|material-icon-theme|PKief|3.9.1|
|msbuild-project-tools|tintoy|0.3.2|
|ng-template|Angular|0.802.3|
|night-owl|sdras|1.1.3|
|night-wolf|MaoSantaella|1.8.1|
|noctis|liviuschera|10.14.0|
|open-in-browser|techer|2.0.0|
|output-colorizer|IBM|0.1.2|
|path-intellisense|christian-kohler|1.4.2|
|quicktype|quicktype|12.0.46|
|rushnav|DevExpress|0.0.5|
|vetur|octref|0.22.6|
|vscode-azurefunctions|ms-azuretools|0.20.0|
|vscode-docker|ms-azuretools|0.8.2|
|vscode-eslint|dbaeumer|1.9.1|
|vscode-svgviewer|cssho|2.0.0|
|vscode-typescript-tslint-plugin|ms-vscode|1.2.2|
|vscodeintellicode|VisualStudioExptTeam|1.2.0|
|vue-vscode-snippets|sdras|1.8.0|
|winteriscoming|johnpapa|1.3.0|;

Resolved-External

Most helpful comment

Yes you can disable the extension and you will see the error go away. There is already an open issue there too https://github.com/tintoy/msbuild-project-tools-vscode/issues/59

All 11 comments

Seems to be related to having .Net Core 3.1 preview installed. Even thought the .csproj file indicates <TargetFramework>netcoreapp3.0</TargetFrameWork>, the .Net Core 3.1 preview tooling is being referenced. Adding a global.json file to specify .Net Core 3.0:

{
  "sdk": {
    "version": "3.0.100"
  }
}

eliminated the error. Updating to a target framework of netcoreapp3.1 (without the global.json) still shows the error)

The same here...

Error ist still alive currently

Same! Even with the .NET Core 3.1 LTS :/

Same yet, 3.1.100

Month and a half later, still the same error. Cannot compile any .Net Core 3.1 applications.

I am unable to reproduce it with the latest extension version + Mono 6.6.0 (like in your example).

Could you please share the repro project - thanks. Maybe you can also set "omnisharp.loggingLevel": "debug" and capture the OmniSharp log then.
Also, what do you mean by Cannot compile any .Net Core 3.1 applications? The OmniSharp extension is not responsible for compiling the applications - dotnet SDK is.

edit:
also, the latest beta of OmniSharp has moved to msbuild 16.4, you could try setting "omnisharp.path": "latest" (which would install the latest beta) and see if it helps..

Actually, I had a look and this problem is caused by extension called msbuild-project-tools and not by OmniSharp.
Therefore I will close this issue. Please open an issue in https://github.com/tintoy/msbuild-project-tools-vscode/

Interesting. I do have that extension installed (it's very helpful when editing the .csproj files)

Yes you can disable the extension and you will see the error go away. There is already an open issue there too https://github.com/tintoy/msbuild-project-tools-vscode/issues/59

Im getting that error:
The expression ""App_StartBootstappers.cs".GetPathsOfAllDirectoriesAbove()" cannot be evaluated. Method 'System.String.GetPathsOfAllDirectoriesAbove' not found. ...packagesMicrosoft.Net.Compilers.3.7.0toolsMicrosoft.Managed.Core.targets

Whats the cause and solution to it?

Was this page helpful?
0 / 5 - 0 ratings