vscode-csharp: Omnisharp crashes upon project load
Environment data
dotnet --info
output:
Tested on two versions.
First:
H:\tmp>dotnet --info
.NET Command Line Tools (1.0.0-preview5-004226)
Product Information:
Version: 1.0.0-preview5-004226
Commit SHA-1 hash: 7b109e4b53
Runtime Environment:
OS Name: Windows
OS Version: 10.0.14393
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\1.0.0-preview5-004226
Second:
H:\tmp>dotnet --info
.NET Command Line Tools (1.0.0-preview5-004232)
Product Information:
Version: 1.0.0-preview5-004232
Commit SHA-1 hash: 355b6233cb
Runtime Environment:
OS Name: Windows
OS Version: 10.0.14393
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\1.0.0-preview5-004232
VS Code version:
Версия 1.8.0
Фиксация 38746938a4ab94f2f57d9e1309c51fd6fb37553d
Дата 2016-12-13T17:45:32.595Z
Оболочка 1.4.6
Обработчик 53.0.2785.143
Node 6.5.0
C# Extension version: 1.6.0-beta4
Steps to reproduce
dotnet new
code .
Expected behavior
Project loads ok
Actual behavior
Console logs:
Starting OmniSharp server at 15.12.2016, 16:58:44
Target: h:\tmp
OmniSharp server started
Path: C:\Users\m.user\.vscode\extensions\ms-vscode.csharp-1.6.0-beta4\bin\omnisharp\OmniSharp.exe
PID: 9920
OmniSharp: -s h:\tmp --hostPID 25200 --stdio DotNet:enablePackageRestore=false --encoding utf-8
[INFORMATION:OmniSharp.Startup] Omnisharp server running using Stdio at location 'h:\tmp' on host 25200.
[INFORMATION:OmniSharp.DotNet.DotNetProjectSystem] Initializing in h:\tmp
[INFORMATION:OmniSharp.DotNet.DotNetProjectSystem] Auto package restore: False
[INFORMATION:OmniSharp.DotNet.DotNetProjectSystem] Update workspace context
[INFORMATION:OmniSharp.DotNet.DotNetProjectSystem] Resolving projects references
[INFORMATION:OmniSharp#MSBuild] MSBuildExtensionsPath environment variable set to C:\Users\m.user\.vscode\extensions\ms-vscode.csharp-1.6.0-beta4\bin\omnisharp\msbuild
[INFORMATION:OmniSharp#MSBuild] MSBUILD_EXE_PATH environment variable set to C:\Users\m.user\.vscode\extensions\ms-vscode.csharp-1.6.0-beta4\bin\omnisharp\msbuild\MSBuild.exe
[INFORMATION:OmniSharp#MSBuild] MSBuildSDKsPath environment variable set to C:\Users\m.user\.vscode\extensions\ms-vscode.csharp-1.6.0-beta4\bin\omnisharp\msbuild\Sdks
[INFORMATION:OmniSharp#MSBuild] No solution files found in 'h:\tmp'
[WARNING:OmniSharp#MSBuild] Failed to process project file 'h:\tmp\tmp.csproj'.
h:\tmp\tmp.csproj(1,1)
System.UriFormatException: Недопустимый URI: Невозможно определить формат URI.
в System.Uri.CreateThis(String uri, Boolean dontEscape, UriKind uriKind)
в Microsoft.Build.Shared.FileUtilities.MakeRelative(String basePath, String path)
в Microsoft.Build.Evaluation.Evaluator`4.ThrowForImportedProjectWithSearchPathsNotFound(ProjectImportPathMatch searchPathMatch, ProjectImportElement importElement)
в Microsoft.Build.Evaluation.Evaluator`4.ExpandAndLoadImports(String directoryOfImportingFile, ProjectImportElement importElement)
в Microsoft.Build.Evaluation.Evaluator`4.EvaluateImportElement(String directoryOfImportingFile, ProjectImportElement importElement)
в Microsoft.Build.Evaluation.Evaluator`4.PerformDepthFirstPass(ProjectRootElement currentProjectOrImport)
в Microsoft.Build.Evaluation.Evaluator`4.EvaluateImportElement(String directoryOfImportingFile, ProjectImportElement importElement)
в Microsoft.Build.Evaluation.Evaluator`4.PerformDepthFirstPass(ProjectRootElement currentProjectOrImport)
в Microsoft.Build.Evaluation.Evaluator`4.Evaluate()
в Microsoft.Build.Evaluation.Project.Reevaluate(ILoggingService loggingServiceForEvaluation, ProjectLoadSettings loadSettings)
в Microsoft.Build.Evaluation.Project.ReevaluateIfNecessary(ILoggingService loggingServiceForEvaluation, ProjectLoadSettings loadSettings)
в Microsoft.Build.Evaluation.Project.Initialize(IDictionary`2 globalProperties, String toolsVersion, String subToolsetVersion, ProjectLoadSettings loadSettings)
в Microsoft.Build.Evaluation.Project..ctor(String projectFile, IDictionary`2 globalProperties, String toolsVersion, String subToolsetVersion, ProjectCollection projectCollection, ProjectLoadSettings loadSettings)
в Microsoft.Build.Evaluation.ProjectCollection.LoadProject(String fileName, IDictionary`2 globalProperties, String toolsVersion)
в OmniSharp.MSBuild.ProjectFile.ProjectFileInfo.Create(String projectFilePath, String solutionDirectory, ILogger logger, MSBuildOptions options, ICollection`1 diagnostics) в C:\Projects\omnisharp-roslyn\src\OmniSharp.MSBuild\ProjectFile\ProjectFileInfo.cs:строка 106
в OmniSharp.MSBuild.MSBuildProjectSystem.CreateProjectFileInfo(String projectFilePath) в C:\Projects\omnisharp-roslyn\src\OmniSharp.MSBuild\MSBuildProjectSystem.cs:строка 365
[INFORMATION:OmniSharp.Script.ScriptProjectSystem] Detecting CSX files in 'h:\tmp'.
[INFORMATION:OmniSharp.Script.ScriptProjectSystem] Could not find any CSX files
[INFORMATION:OmniSharp.Startup] Configuration finished.
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 18 (9 by maintainers)
I’ve released 1.6-beta6 and verified that it actually has my changes this time. 😄
Let me know if this works better for you.
OK. Though note that it’s a bit messy.
The UriFormatException happens fairly deep in MSBuild project evaluation. Yesterday, the issue I fixed related to this was a situation where of the MSBuild properties in
%USERPROFILE\.vscode\extensions\ms-vscode.csharp-1.6.0-beta5\bin\omnisharp\msbuild\MSBuild.exe.config
were not expanding properly. Essentially, OmniSharp setMSBuildExtensionsPath
as an environment variable. However, this config file definesMSBuildExtensionsPath
as well, which overrode the environment variable. The definition in the config file is$(VsInstallRoot)\MSBuild
, which expanded to\MSBuild
on machines without VS, resulting in a UriFormatException. I fixed this by settingMSBuildExtensionsPath
as a global variable here.You might try deleting values from the MSBuild.exe.config file at the path above and see if that addresses the problem. Perhaps removing the “projectImportSearchPaths” node would fix the problem?