vscode-csharp: vscode c# / omnisharp not starting after updating to 1.13.0
Hi, sorry to be a pain I’ve been trying to work this out but don’t know enough about the software! I expect this is something that I’m doing wrong.
Environment data
dotnet --info
output:
.NET Command Line Tools (2.0.2)
Product Information:
Version: 2.0.2
Commit SHA-1 hash: a04b4bf512
Runtime Environment:
OS Name: Mac OS X
OS Version: 10.12
OS Platform: Darwin
RID: osx.10.12-x64
Base Path: /usr/local/share/dotnet/sdk/2.0.2/
Microsoft .NET Core Shared Framework Host
Version : 2.0.0
Build : e8b8861ac7faf042c87a5c2f9f2d04c98b69f28d
VS Code version: 1.17.2 (1.17.2) C# Extension version: 1.13.0
Steps to reproduce
- Upgrade vscode c# extension to 1.13.0
- Open asp.net core 2.0 solution (I have tried two solutions). They have multiple csproj and I get the same stack trace below for each csproj in the solution. I’m opening them by just loading vscode in the solution root directory.
global.json:
{
"projects": [ "src", "test" ],
"sdk": {
"version": "2.0.0"
}
}
and I also tried…
global.json:
{
"projects": [ "src", "test" ],
"sdk": {
"version": "2.0.2"
}
}
Expected behavior
I don’t know what the Output is normally but I guess vscode c# extension starts up as usual and omnisharp kicks in.
Actual behavior
Stack trace from vscode Output below:
Starting OmniSharp server at 2017-11-8 07:36:17
Target: /Users/TGP/Documents/git/Ocelot/Ocelot.sln
OmniSharp server started wth Mono
Path: /Users/TGP/.vscode/extensions/ms-vscode.csharp-1.13.0/.omnisharp/run
PID: 48934
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
Located 1 MSBuild instance(s)
1: StandAlone 15.0 - "/Users/TGP/.vscode/extensions/ms-vscode.csharp-1.13.0/.omnisharp/omnisharp/msbuild/15.0/Bin"
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
MSBUILD_EXE_PATH environment variable set to '/Users/TGP/.vscode/extensions/ms-vscode.csharp-1.13.0/.omnisharp/omnisharp/msbuild/15.0/Bin/MSBuild.dll'
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
Registered MSBuild instance: StandAlone 15.0 - "/Users/TGP/.vscode/extensions/ms-vscode.csharp-1.13.0/.omnisharp/omnisharp/msbuild/15.0/Bin"
MSBuildExtensionsPath = /Library/Frameworks/Mono.framework/Versions/4.8.0/lib/mono/xbuild
CscToolPath = /Users/TGP/.vscode/extensions/ms-vscode.csharp-1.13.0/.omnisharp/omnisharp/msbuild/15.0/Bin/Roslyn
CscToolExe = csc.exe
MSBuildToolsPath = /Users/TGP/.vscode/extensions/ms-vscode.csharp-1.13.0/.omnisharp/omnisharp/msbuild/15.0/Bin
TargetFrameworkRootPath = /Library/Frameworks/Mono.framework/Versions/4.8.0/lib/mono/xbuild-frameworks
[info]: OmniSharp.Cake.CakeProjectSystem
Detecting Cake files in '/Users/TGP/Documents/git/Ocelot'.
[info]: OmniSharp.Cake.CakeProjectSystem
Found 1 Cake files.
[warn]: OmniSharp.Cake.CakeProjectSystem
Cake script service not connected. Aborting.
[info]: OmniSharp.DotNet.DotNetProjectSystem
Initializing in /Users/TGP/Documents/git/Ocelot
[info]: OmniSharp.DotNet.DotNetProjectSystem
Auto package restore: False
[info]: OmniSharp.DotNet.DotNetProjectSystem
Update workspace context
[info]: OmniSharp.DotNet.DotNetProjectSystem
Resolving projects references
[info]: OmniSharp.MSBuild.MSBuildProjectSystem
Detecting projects in '/Users/TGP/Documents/git/Ocelot/Ocelot.sln'.
[info]: OmniSharp.MSBuild.MSBuildProjectSystem
Loading project: /Users/TGP/Documents/git/Ocelot/src/Ocelot/Ocelot.csproj
The specified SDK version [2.0.0] from global.json [/Users/TGP/Documents/git/Ocelot/global.json] not found; install specified SDK version
[warn]: OmniSharp.MSBuild.MSBuildProjectSystem
Failed to load project file '/Users/TGP/Documents/git/Ocelot/src/Ocelot/Ocelot.csproj'.
/Users/TGP/Documents/git/Ocelot/src/Ocelot/Ocelot.csproj(1,1)
Microsoft.Build.Exceptions.InvalidProjectFileException: The SDK 'Microsoft.NET.Sdk' specified could not be found. /Users/TGP/Documents/git/Ocelot/src/Ocelot/Ocelot.csproj
at Microsoft.Build.Shared.ProjectErrorUtilities.ThrowInvalidProject (System.String errorSubCategoryResourceName, Microsoft.Build.Shared.IElementLocation elementLocation, System.String resourceName, System.Object[] args) [0x00042] in <9ba305957e954df9b0ed46d97ba8f5be>:0
at Microsoft.Build.Shared.ProjectErrorUtilities.VerifyThrowInvalidProject[T1] (System.Boolean condition, System.String errorSubCategoryResourceName, Microsoft.Build.Shared.IElementLocation elementLocation, System.String resourceName, T1 arg0) [0x00003] in <9ba305957e954df9b0ed46d97ba8f5be>:0
at Microsoft.Build.Shared.ProjectErrorUtilities.ThrowInvalidProject[T1] (Microsoft.Build.Shared.IElementLocation elementLocation, System.String resourceName, T1 arg0) [0x00000] in <9ba305957e954df9b0ed46d97ba8f5be>:0
at Microsoft.Build.Evaluation.Evaluator`4[P,I,M,D].ExpandAndLoadImportsFromUnescapedImportExpressionConditioned (System.String directoryOfImportingFile, Microsoft.Build.Construction.ProjectImportElement importElement, System.Collections.Generic.List`1[Microsoft.Build.Construction.ProjectRootElement]& projects, System.Boolean throwOnFileNotExistsError) [0x00198] in <9ba305957e954df9b0ed46d97ba8f5be>:0
at Microsoft.Build.Evaluation.Evaluator`4[P,I,M,D].ExpandAndLoadImports (System.String directoryOfImportingFile, Microsoft.Build.Construction.ProjectImportElement importElement) [0x00024] in <9ba305957e954df9b0ed46d97ba8f5be>:0
at Microsoft.Build.Evaluation.Evaluator`4[P,I,M,D].EvaluateImportElement (System.String directoryOfImportingFile, Microsoft.Build.Construction.ProjectImportElement importElement) [0x00000] in <9ba305957e954df9b0ed46d97ba8f5be>:0
at Microsoft.Build.Evaluation.Evaluator`4[P,I,M,D].PerformDepthFirstPass (Microsoft.Build.Construction.ProjectRootElement currentProjectOrImport) [0x000c8] in <9ba305957e954df9b0ed46d97ba8f5be>:0
at Microsoft.Build.Evaluation.Evaluator`4[P,I,M,D].Evaluate (Microsoft.Build.BackEnd.Logging.ILoggingService loggingService, Microsoft.Build.Framework.BuildEventContext buildEventContext) [0x000df] in <9ba305957e954df9b0ed46d97ba8f5be>:0
at Microsoft.Build.Evaluation.Evaluator`4[P,I,M,D].Evaluate (Microsoft.Build.Evaluation.IEvaluatorData`4[P,I,M,D] data, Microsoft.Build.Construction.ProjectRootElement root, Microsoft.Build.Evaluation.ProjectLoadSettings loadSettings, System.Int32 maxNodeCount, Microsoft.Build.Collections.PropertyDictionary`1[T] environmentProperties, Microsoft.Build.BackEnd.Logging.ILoggingService loggingService, Microsoft.Build.Evaluation.IItemFactory`2[S,T] itemFactory, Microsoft.Build.Evaluation.IToolsetProvider toolsetProvider, Microsoft.Build.Evaluation.ProjectRootElementCache projectRootElementCache, Microsoft.Build.Framework.BuildEventContext buildEventContext, Microsoft.Build.Execution.ProjectInstance projectInstanceIfAnyForDebuggerOnly, Microsoft.Build.BackEnd.SdkResolution sdkResolution) [0x00016] in <9ba305957e954df9b0ed46d97ba8f5be>:0
at Microsoft.Build.Evaluation.Project.Reevaluate (Microsoft.Build.BackEnd.Logging.ILoggingService loggingServiceForEvaluation, Microsoft.Build.Evaluation.ProjectLoadSettings loadSettings) [0x0004c] in <9ba305957e954df9b0ed46d97ba8f5be>:0
at Microsoft.Build.Evaluation.Project.ReevaluateIfNecessary (Microsoft.Build.BackEnd.Logging.ILoggingService loggingServiceForEvaluation, Microsoft.Build.Evaluation.ProjectLoadSettings loadSettings) [0x00034] in <9ba305957e954df9b0ed46d97ba8f5be>:0
at Microsoft.Build.Evaluation.Project.ReevaluateIfNecessary (Microsoft.Build.BackEnd.Logging.ILoggingService loggingServiceForEvaluation) [0x00000] in <9ba305957e954df9b0ed46d97ba8f5be>:0
at Microsoft.Build.Evaluation.Project.ReevaluateIfNecessary () [0x00007] in <9ba305957e954df9b0ed46d97ba8f5be>:0
at Microsoft.Build.Evaluation.Project.Initialize (System.Collections.Generic.IDictionary`2[TKey,TValue] globalProperties, System.String toolsVersion, System.String subToolsetVersion, Microsoft.Build.Evaluation.ProjectLoadSettings loadSettings) [0x000e9] in <9ba305957e954df9b0ed46d97ba8f5be>:0
at Microsoft.Build.Evaluation.Project..ctor (System.String projectFile, System.Collections.Generic.IDictionary`2[TKey,TValue] globalProperties, System.String toolsVersion, System.String subToolsetVersion, Microsoft.Build.Evaluation.ProjectCollection projectCollection, Microsoft.Build.Evaluation.ProjectLoadSettings loadSettings) [0x0009c] in <9ba305957e954df9b0ed46d97ba8f5be>:0
at Microsoft.Build.Evaluation.Project..ctor (System.String projectFile, System.Collections.Generic.IDictionary`2[TKey,TValue] globalProperties, System.String toolsVersion, Microsoft.Build.Evaluation.ProjectCollection projectCollection, Microsoft.Build.Evaluation.ProjectLoadSettings loadSettings) [0x00000] in <9ba305957e954df9b0ed46d97ba8f5be>:0
at Microsoft.Build.Evaluation.Project..ctor (System.String projectFile, System.Collections.Generic.IDictionary`2[TKey,TValue] globalProperties, System.String toolsVersion, Microsoft.Build.Evaluation.ProjectCollection projectCollection) [0x00000] in <9ba305957e954df9b0ed46d97ba8f5be>:0
at Microsoft.Build.Evaluation.ProjectCollection.LoadProject (System.String fileName, System.Collections.Generic.IDictionary`2[TKey,TValue] globalProperties, System.String toolsVersion) [0x000f5] in <9ba305957e954df9b0ed46d97ba8f5be>:0
at Microsoft.Build.Evaluation.ProjectCollection.LoadProject (System.String fileName, System.String toolsVersion) [0x00000] in <9ba305957e954df9b0ed46d97ba8f5be>:0
at OmniSharp.MSBuild.ProjectFile.ProjectFileInfo.LoadProject (System.String filePath, System.String solutionDirectory, Microsoft.Extensions.Logging.ILogger logger, OmniSharp.MSBuild.Discovery.MSBuildInstance msbuildInstance, OmniSharp.Options.MSBuildOptions options, System.Collections.Generic.ICollection`1[T] diagnostics, System.Collections.Immutable.ImmutableArray`1[System.String]& targetFrameworks) [0x0004b] in <4334175a8f8f4b01b5db9f56f106c232>:0
at OmniSharp.MSBuild.ProjectFile.ProjectFileInfo.Create (System.String filePath, System.String solutionDirectory, Microsoft.Extensions.Logging.ILogger logger, OmniSharp.MSBuild.Discovery.MSBuildInstance msbuildInstance, OmniSharp.Options.MSBuildOptions options, System.Collections.Generic.ICollection`1[T] diagnostics) [0x0000a] in <4334175a8f8f4b01b5db9f56f106c232>:0
at OmniSharp.MSBuild.MSBuildProjectSystem.LoadProject (System.String projectFilePath) [0x00038] in <4334175a8f8f4b01b5db9f56f106c232>:0
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 1
- Comments: 24 (12 by maintainers)
Edited: updated this with a newer release of OmniSharp that will work with C# for VS 1.13.
Another potential workaround that would allow you to stay on C# for VS 1.13 until the next version comes out would be to use a newer version of OmniSharp which fixes already contains a fix for the issue.
Download OmniSharp 1.26.3 from https://github.com/OmniSharp/omnisharp-roslyn/releases/tag/v1.26.3. You’ll want to download the appropriate version for your system.
Untar/zip the file to a folder. On Linux/OSX, you should also
chmod 755
therun
andmono.*
files within the folder you decompressed to.In VS Code, set the following options:
Restart VS Code.
A workaround while this issue is being fixed:
code --install-extension csharp-1.11.0.vsix
(Install from a VSIX section https://code.visualstudio.com/docs/editor/extension-gallery){"extensions.autoUpdate": true}
to{"extensions.autoUpdate": false}
(https://github.com/Microsoft/vscode/issues/9367)The error that you’re getting still indicates that the global.json says 2.0.0:
Could you change that global.json to specify 2.0.2, save it, restart VS Code, and let me know what the OmniSharp Log reads in that case?