Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OmniSharp initialization error in VSCode: OmniSharp.MSBuild.MSBuildProjectSystem #1580

Closed
mattcotton-justgiving opened this issue Jun 19, 2017 · 4 comments
Assignees
Milestone

Comments

@mattcotton-justgiving
Copy link

mattcotton-justgiving commented Jun 19, 2017

Environment data

dotnet --info output:

.NET Command Line Tools (2.0.0-preview1-005977)

Product Information:
 Version:            2.0.0-preview1-005977
 Commit SHA-1 hash:  414cab8a0b

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.0-preview1-005977/

Microsoft .NET Core Shared Framework Host

  Version  : 2.0.0-preview1-002111-00
  Build    : 1ff021936263d492539399688f46fd3827169983

VS Code version: Version 1.13.1 (1.13.1)

C# Extension version: 1.10.0

Steps to reproduce

Open VS code at folder containing .sln file.

Expected behavior

Should read .sln file and then recognise/load all contained .csproj files.
Should be able to navigate from a class reference e.g. "var o = new MyClass();", to its declaration.

Actual behavior

Produces errors when parsing .sln file (attached).
Can't navigate from class reference to class declaration.

Attached OmniSharp output

OmniSharp: -s /Users/mcotton/code/git/GG.Library.ConfigProvider.Vault/GG.Library.ConfigProvider.Vault.sln --hostPID 69765 --stdio DotNet:enablePackageRestore=false --encoding utf-8 --loglevel information formattingOptions:useTabs=false formattingOptions:tabSize=4 formattingOptions:indentationSize=4
{"Event":"log","Body":{"LogLevel":"INFORMATION","Name":"OmniSharp.Startup","Message":"Omnisharp server running using Stdio at location '/Users/mcotton/code/git/GG.Library.ConfigProvider.Vault' on host 69765."},"Seq":1,"Type":"event"}
[info]: OmniSharp.DotNet.DotNetProjectSystem
        Initializing in /Users/mcotton/code/git/GG.Library.ConfigProvider.Vault
[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
        MSBUILD_EXE_PATH environment variable set to /Users/mcotton/.vscode/extensions/ms-vscode.csharp-1.10.0/bin/omnisharp/msbuild/MSBuild.dll
[info]: OmniSharp.MSBuild.MSBuildProjectSystem
        MSBuildExtensionsPath environment variable set to /Users/mcotton/.vscode/extensions/ms-vscode.csharp-1.10.0/bin/omnisharp/msbuild
[info]: OmniSharp.MSBuild.MSBuildProjectSystem
        MSBuild will use local OmniSharp installation.
[info]: OmniSharp.MSBuild.MSBuildProjectSystem
        Detecting projects in '/Users/mcotton/code/git/GG.Library.ConfigProvider.Vault/GG.Library.ConfigProvider.Vault.sln'.
[fail]: OmniSharp.Startup
        The project system 'OmniSharp.MSBuild.MSBuildProjectSystem' threw exception during initialization.
System.Exception: Expected Project.
  at OmniSharp.MSBuild.SolutionParsing.ProjectBlock.Parse (System.IO.TextReader reader) [0x00037] in <58a4b7d2ae4242df95a004e5b08191a6>:0 
  at OmniSharp.MSBuild.SolutionParsing.SolutionFile.Parse (System.IO.TextReader reader) [0x000d9] in <58a4b7d2ae4242df95a004e5b08191a6>:0 
  at OmniSharp.MSBuild.SolutionParsing.SolutionFile.Parse (System.String solutionFileName) [0x0000e] in <58a4b7d2ae4242df95a004e5b08191a6>:0 
  at OmniSharp.MSBuild.MSBuildProjectSystem.GetProjectPathsFromSolution (System.String solutionFilePath) [0x0001b] in <58a4b7d2ae4242df95a004e5b08191a6>:0 
  at OmniSharp.MSBuild.MSBuildProjectSystem.GetInitialProjectPaths () [0x0002f] in <58a4b7d2ae4242df95a004e5b08191a6>:0 
  at OmniSharp.MSBuild.MSBuildProjectSystem.Initalize (Microsoft.Extensions.Configuration.IConfiguration configuration) [0x00064] in <58a4b7d2ae4242df95a004e5b08191a6>:0 
  at OmniSharp.Startup.InitializeWorkspace (OmniSharp.OmniSharpWorkspace workspace, System.Composition.Hosting.CompositionHost compositionHost, Microsoft.Extensions.Configuration.IConfiguration configuration, Microsoft.Extensions.Logging.ILogger logger, OmniSharp.Options.OmniSharpOptions options) [0x0002d] in <bccfb945ce864181b80616703dd0cec3>:0 
[info]: OmniSharp.Script.ScriptProjectSystem
        Detecting CSX files in '/Users/mcotton/code/git/GG.Library.ConfigProvider.Vault'.
[info]: OmniSharp.Script.ScriptProjectSystem
        Could not find any CSX files
[info]: OmniSharp.Startup
        Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.CSharpWorkspaceOptionsProvider
[info]: OmniSharp.Startup
        Configuration finished.
@DustinCampbell
Copy link
Member

@mattcotton-justgiving: Could you provide the SLN file?

@mattcotton-justgiving
Copy link
Author

mattcotton-justgiving commented Jun 19, 2017

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26124.0
MinimumVisualStudioVersion = 15.0.26124.0
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{3C622F77-3C74-474E-AC38-7F30E9235F63}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GG.Library.ConfigProvider.Vault", "src\GG.Library.ConfigProvider.Vault\GG.Library.ConfigProvider.Vault.csproj", "{1D50BF95-C9C0-4EF0-B869-0194684E8519}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{4CFA9523-BC33-4C49-BF8E-554943CDC653}"
ProjectSection(SolutionItems) = preProject
	build\Readme.txt = build\Readme.txt
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{65E7B2FA-C1D0-411C-82D7-0DF418A16555}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GG.Library.ConfigProvider.Vault.Test", "test\GG.Library.ConfigProvider.Vault.Test\GG.Library.ConfigProvider.Vault.Test.csproj", "{0C768495-EA52-4703-AEAF-316A4C0A01CB}"
EndProject
Global
	GlobalSection(SolutionConfigurationPlatforms) = preSolution
		Debug|Any CPU = Debug|Any CPU
		Debug|x64 = Debug|x64
		Debug|x86 = Debug|x86
		Release|Any CPU = Release|Any CPU
		Release|x64 = Release|x64
		Release|x86 = Release|x86
	EndGlobalSection
	GlobalSection(SolutionProperties) = preSolution
		HideSolutionNode = FALSE
	EndGlobalSection
	GlobalSection(ProjectConfigurationPlatforms) = postSolution
		{1D50BF95-C9C0-4EF0-B869-0194684E8519}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{1D50BF95-C9C0-4EF0-B869-0194684E8519}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{1D50BF95-C9C0-4EF0-B869-0194684E8519}.Debug|x64.ActiveCfg = Debug|x64
		{1D50BF95-C9C0-4EF0-B869-0194684E8519}.Debug|x64.Build.0 = Debug|x64
		{1D50BF95-C9C0-4EF0-B869-0194684E8519}.Debug|x86.ActiveCfg = Debug|x86
		{1D50BF95-C9C0-4EF0-B869-0194684E8519}.Debug|x86.Build.0 = Debug|x86
		{1D50BF95-C9C0-4EF0-B869-0194684E8519}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{1D50BF95-C9C0-4EF0-B869-0194684E8519}.Release|Any CPU.Build.0 = Release|Any CPU
		{1D50BF95-C9C0-4EF0-B869-0194684E8519}.Release|x64.ActiveCfg = Release|x64
		{1D50BF95-C9C0-4EF0-B869-0194684E8519}.Release|x64.Build.0 = Release|x64
		{1D50BF95-C9C0-4EF0-B869-0194684E8519}.Release|x86.ActiveCfg = Release|x86
		{1D50BF95-C9C0-4EF0-B869-0194684E8519}.Release|x86.Build.0 = Release|x86
		{0C768495-EA52-4703-AEAF-316A4C0A01CB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{0C768495-EA52-4703-AEAF-316A4C0A01CB}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{0C768495-EA52-4703-AEAF-316A4C0A01CB}.Debug|x64.ActiveCfg = Debug|x64
		{0C768495-EA52-4703-AEAF-316A4C0A01CB}.Debug|x64.Build.0 = Debug|x64
		{0C768495-EA52-4703-AEAF-316A4C0A01CB}.Debug|x86.ActiveCfg = Debug|x86
		{0C768495-EA52-4703-AEAF-316A4C0A01CB}.Debug|x86.Build.0 = Debug|x86
		{0C768495-EA52-4703-AEAF-316A4C0A01CB}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{0C768495-EA52-4703-AEAF-316A4C0A01CB}.Release|Any CPU.Build.0 = Release|Any CPU
		{0C768495-EA52-4703-AEAF-316A4C0A01CB}.Release|x64.ActiveCfg = Release|x64
		{0C768495-EA52-4703-AEAF-316A4C0A01CB}.Release|x64.Build.0 = Release|x64
		{0C768495-EA52-4703-AEAF-316A4C0A01CB}.Release|x86.ActiveCfg = Release|x86
		{0C768495-EA52-4703-AEAF-316A4C0A01CB}.Release|x86.Build.0 = Release|x86
	EndGlobalSection
	GlobalSection(NestedProjects) = preSolution
		{1D50BF95-C9C0-4EF0-B869-0194684E8519} = {3C622F77-3C74-474E-AC38-7F30E9235F63}
		{0C768495-EA52-4703-AEAF-316A4C0A01CB} = {65E7B2FA-C1D0-411C-82D7-0DF418A16555}
	EndGlobalSection
EndGlobal

@DustinCampbell
Copy link
Member

Thanks for the help! It looks like the solution parser fails because it expects "ProjectSection" to be indented.

DustinCampbell added a commit to DustinCampbell/omnisharp-roslyn that referenced this issue Jun 26, 2017
DustinCampbell added a commit to DustinCampbell/omnisharp-roslyn that referenced this issue Jun 26, 2017
@DustinCampbell DustinCampbell added this to the 1.12 milestone Jun 27, 2017
@DustinCampbell DustinCampbell self-assigned this Jun 27, 2017
@DustinCampbell
Copy link
Member

I've just fixed this in OmniSharp. Unfortunately, the fix won't make the next release of C# for VS Code (1.11), but you can expect to see it fixed in the release after that (1.12). Until then, you should be able to workaround the problem by indenting the following lines in your SLN file:

ProjectSection(SolutionItems) = preProject
	build\Readme.txt = build\Readme.txt
EndProjectSection

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants