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

Script project system fails to initialize in VS Code 1.15.0 (1.30.0 release of OmniSharp) on macOS #1184

Closed
filipw opened this issue May 11, 2018 · 9 comments · Fixed by #1185

Comments

@filipw
Copy link
Member

filipw commented May 11, 2018

Environment data

dotnet --info output: 2.1.300-rc1-008673
VS Code version: 1.23.1
C# Extension version: 1.15.0

Steps to reproduce

  1. Create a temp folder with a dummy.csx and the following content
var text = "hello";
Console.WriteLine(text);
  1. Open VS Code to that folder.

Expected behavior

Script project system initializes correctly and language services light up.

Actual behavior

Script project system fails to initialize. This doesn't crash OmniSharp but prevents language services for CSX.

The output is

Starting OmniSharp server at 2018-5-11 08:56:41
    Target: /Users/filip/Documents/dev/csharp-scripting-demos/build

OmniSharp server started with Mono 5.8.0
    Path: /Users/filip/.vscode/extensions/ms-vscode.csharp-1.15.0/.omnisharp/1.30.0/omnisharp/OmniSharp.exe
    PID: 72463

[info]: OmniSharp.Stdio.Host
        Starting OmniSharp on MacOS 10.12.6 (x64)
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Located 2 MSBuild instance(s)
            1: Mono 15.0 - "/Library/Frameworks/Mono.framework/Versions/5.8.0/lib/mono/msbuild/15.0/bin"
            2: StandAlone 15.0 - "/Users/filip/.vscode/extensions/ms-vscode.csharp-1.15.0/.omnisharp/1.30.0/omnisharp/msbuild/15.0/Bin"
[trce]: OmniSharp.Services.AssemblyLoader
        Assembly loaded from path: /Library/Frameworks/Mono.framework/Versions/5.8.0/lib/mono/msbuild/15.0/bin/Microsoft.Build.Utilities.Core.dll
[dbug]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Resolved 'Microsoft.Build.Utilities.Core' to '/Library/Frameworks/Mono.framework/Versions/5.8.0/lib/mono/msbuild/15.0/bin/Microsoft.Build.Utilities.Core.dll'
[trce]: OmniSharp.Services.AssemblyLoader
        Assembly loaded from path: /Library/Frameworks/Mono.framework/Versions/5.8.0/lib/mono/msbuild/15.0/bin/Microsoft.Build.Tasks.Core.dll
[dbug]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Resolved 'Microsoft.Build.Tasks.Core' to '/Library/Frameworks/Mono.framework/Versions/5.8.0/lib/mono/msbuild/15.0/bin/Microsoft.Build.Tasks.Core.dll'
[trce]: OmniSharp.Services.AssemblyLoader
        Assembly loaded from path: /Library/Frameworks/Mono.framework/Versions/5.8.0/lib/mono/msbuild/15.0/bin/Microsoft.Build.Framework.dll
[dbug]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Resolved 'Microsoft.Build.Framework' to '/Library/Frameworks/Mono.framework/Versions/5.8.0/lib/mono/msbuild/15.0/bin/Microsoft.Build.Framework.dll'
[trce]: OmniSharp.Services.AssemblyLoader
        Assembly loaded from path: /Library/Frameworks/Mono.framework/Versions/5.8.0/lib/mono/msbuild/15.0/bin/Microsoft.Build.dll
[dbug]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Resolved 'Microsoft.Build' to '/Library/Frameworks/Mono.framework/Versions/5.8.0/lib/mono/msbuild/15.0/bin/Microsoft.Build.dll'
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Registered MSBuild instance: Mono 15.0 - "/Library/Frameworks/Mono.framework/Versions/5.8.0/lib/mono/msbuild/15.0/bin"
            CscToolPath = /Users/filip/.vscode/extensions/ms-vscode.csharp-1.15.0/.omnisharp/1.30.0/omnisharp/msbuild/15.0/Bin/Roslyn
            CscToolExe = csc.exe
[trce]: OmniSharp.Services.AssemblyLoader
        Assembly loaded from path: /Users/filip/Documents/omnisharp-ext/DiacriticRemoverDotNext.dll
[trce]: OmniSharp.Services.AssemblyLoader
        Assembly loaded from path: /Users/filip/Documents/omnisharp-ext/Roslynator.CSharp.Refactorings.dll
[trce]: OmniSharp.Services.AssemblyLoader
        Assembly loaded from path: /Users/filip/Documents/omnisharp-ext/Roslynator.Common.dll
[trce]: OmniSharp.Services.AssemblyLoader
        Assembly loaded from path: /Users/filip/Documents/omnisharp-ext/Roslynator.Core.dll
[trce]: OmniSharp.Services.AssemblyLoader
        Assembly loaded: Microsoft.CodeAnalysis.Features, Version=2.7.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
[trce]: OmniSharp.Services.AssemblyLoader
        Assembly loaded: Microsoft.CodeAnalysis.CSharp.Features, Version=2.7.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
[dbug]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Attempting to resolve 'Microsoft.CodeAnalysis.VisualBasic.Workspaces, Version=2.7.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
[dbug]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Attempting to resolve 'Microsoft.CodeAnalysis.VisualBasic.Features, Version=2.7.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
[trce]: OmniSharp.HostServicesAggregator
        Successfully added DiacriticRemoverDotNext, Version=1.0.6352.29906, Culture=neutral, PublicKeyToken=null to host service assemblies.
[trce]: OmniSharp.HostServicesAggregator
        Successfully added Roslynator.CSharp.Refactorings, Version=1.4.0.0, Culture=neutral, PublicKeyToken=33ae4d639eb665dc to host service assemblies.
[trce]: OmniSharp.HostServicesAggregator
        Successfully added Roslynator.Common, Version=1.4.0.0, Culture=neutral, PublicKeyToken=ba9e36134d755ccb to host service assemblies.
[trce]: OmniSharp.HostServicesAggregator
        Successfully added Roslynator.Core, Version=1.4.0.0, Culture=neutral, PublicKeyToken=83fd7bf6b74c2187 to host service assemblies.
[trce]: OmniSharp.HostServicesAggregator
        Successfully added Microsoft.CodeAnalysis.Features, Version=2.7.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35 to host service assemblies.
[trce]: OmniSharp.HostServicesAggregator
        Successfully added Microsoft.CodeAnalysis.CSharp.Features, Version=2.7.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35 to host service assemblies.
[info]: OmniSharp.Cake.CakeProjectSystem
        Detecting Cake files in '/Users/filip/Documents/dev/csharp-scripting-demos/build'.
[info]: OmniSharp.Cake.CakeProjectSystem
        Could not find any Cake files
[info]: OmniSharp.DotNet.DotNetProjectSystem
        Initializing in /Users/filip/Documents/dev/csharp-scripting-demos/build
[info]: OmniSharp.DotNet.DotNetProjectSystem
        Auto package restore: False
[info]: OmniSharp.DotNet.DotNetProjectSystem
        Update workspace context
[info]: OmniSharp.DotNet.DotNetProjectSystem
        Update project /Users/filip/Documents/dev/csharp-scripting-demos/build
[warn]: OmniSharp.DotNet.DotNetProjectSystem
        Cannot create any ProjectContext from project /Users/filip/Documents/dev/csharp-scripting-demos/build
[info]: OmniSharp.DotNet.DotNetProjectSystem
        Resolving projects references
[dbug]: OmniSharp.MSBuild.ProjectSystem
        MSBuild environment: 
Mode: Standalone
RunningTests: False
RunningInVisualStudio: False
MSBuildToolsDirectory32: /Library/Frameworks/Mono.framework/Versions/5.8.0/lib/mono/msbuild/15.0/bin
MSBuildToolsDirectory64: /Library/Frameworks/Mono.framework/Versions/5.8.0/lib/mono/msbuild/15.0/bin
MSBuildSDKsPath: /Library/Frameworks/Mono.framework/Versions/5.8.0/lib/mono/msbuild/15.0/bin/Sdks
CurrentMSBuildConfigurationFile: /Library/Frameworks/Mono.framework/Versions/5.8.0/lib/mono/msbuild/15.0/bin/MSBuild.dll.config
CurrentMSBuildExePath: /Library/Frameworks/Mono.framework/Versions/5.8.0/lib/mono/msbuild/15.0/bin/MSBuild.dll
CurrentMSBuildToolsDirectory: /Library/Frameworks/Mono.framework/Versions/5.8.0/lib/mono/msbuild/15.0/bin
VisualStudioInstallRootDirectory: 
MSBuildExtensionsPath: /Library/Frameworks/Mono.framework/Versions/5.8.0/lib/mono/msbuild/15.0/bin

[dbug]: OmniSharp.MSBuild.ProjectLoader
        'CscToolPath' set to '/Users/filip/.vscode/extensions/ms-vscode.csharp-1.15.0/.omnisharp/1.30.0/omnisharp/msbuild/15.0/Bin/Roslyn'
[dbug]: OmniSharp.MSBuild.ProjectLoader
        'CscToolExe' set to 'csc.exe'
[info]: OmniSharp.MSBuild.ProjectSystem
        No solution files found in '/Users/filip/Documents/dev/csharp-scripting-demos/build'
[dbug]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Attempting to resolve 'System.Runtime.Loader, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
[info]: OmniSharp.Script.ScriptProjectSystem
        Detecting CSX files in '/Users/filip/Documents/dev/csharp-scripting-demos/build'.
[info]: OmniSharp.Script.ScriptProjectSystem
        Found 2 CSX files.
[info]: OmniSharp.Script.ScriptProjectSystem
        Searching for compilation dependencies with the fallback framework of 'net46'.
[info]: OmniSharp.Script.ScriptProjectSystem
        Unable to find dependency context for CSX files. Will default to non-context usage (Desktop CLR scripts).
[dbug]: OmniSharp.Services.MetadataFileReferenceCache
        Cache miss /Library/Frameworks/Mono.framework/Versions/5.8.0/lib/mono/4.5/mscorlib.dll
[dbug]: OmniSharp.Services.MetadataFileReferenceCache
        Cache miss /Library/Frameworks/Mono.framework/Versions/5.8.0/lib/mono/gac/System.Core/4.0.0.0__b77a5c561934e089/System.Core.dll
[dbug]: OmniSharp.Services.MetadataFileReferenceCache
        Cache miss /Library/Frameworks/Mono.framework/Versions/5.8.0/lib/mono/gac/System/4.0.0.0__b77a5c561934e089/System.dll
[dbug]: OmniSharp.Services.MetadataFileReferenceCache
        Cache miss /Library/Frameworks/Mono.framework/Versions/5.8.0/lib/mono/gac/System.ComponentModel.Composition/4.0.0.0__b77a5c561934e089/System.ComponentModel.Composition.dll
[dbug]: OmniSharp.Services.MetadataFileReferenceCache
        Cache miss /Library/Frameworks/Mono.framework/Versions/5.8.0/lib/mono/4.5/Facades/System.Runtime.dll
[fail]: OmniSharp.Stdio.Host
        The project system 'OmniSharp.Script.ScriptProjectSystem' threw exception during initialization.
System.InvalidOperationException: Cannot find reference assembly 'Microsoft.CodeAnalysis.CSharp.dll' file for package Microsoft.CodeAnalysis.CSharp.Reference
  at Microsoft.Extensions.DependencyModel.Resolution.ReferenceAssemblyPathResolver.TryResolveAssemblyPaths (Microsoft.Extensions.DependencyModel.CompilationLibrary library, System.Collections.Generic.List`1[T] assemblies) [0x00046] in <43391b1e7c3f430bb096ac6ec60bb276>:0 
  at Microsoft.Extensions.DependencyModel.Resolution.CompositeCompilationAssemblyResolver.TryResolveAssemblyPaths (Microsoft.Extensions.DependencyModel.CompilationLibrary library, System.Collections.Generic.List`1[T] assemblies) [0x0000f] in <43391b1e7c3f430bb096ac6ec60bb276>:0 
  at Microsoft.Extensions.DependencyModel.CompilationLibrary.ResolveReferencePaths (Microsoft.Extensions.DependencyModel.Resolution.ICompilationAssemblyResolver resolver, System.Collections.Generic.List`1[T] assemblies) [0x00000] in <43391b1e7c3f430bb096ac6ec60bb276>:0 
  at Microsoft.Extensions.DependencyModel.CompilationLibrary.ResolveReferencePaths () [0x0000c] in <43391b1e7c3f430bb096ac6ec60bb276>:0 
  at OmniSharp.Script.ScriptProjectSystem+<>c.<Initalize>b__22_3 (Microsoft.Extensions.DependencyModel.CompilationLibrary x) [0x00000] in <639a01402a864f1c988790c921d4193f>:0 
  at System.Linq.Enumerable+SelectManySingleSelectorIterator`2[TSource,TResult].MoveNext () [0x00051] in <f84aa906ee264c4a932d8627b3559eb9>:0 
  at OmniSharp.Script.ScriptProjectSystem.Initalize (Microsoft.Extensions.Configuration.IConfiguration configuration) [0x0023c] in <639a01402a864f1c988790c921d4193f>:0 
  at OmniSharp.WorkspaceInitializer.Initialize (System.IServiceProvider serviceProvider, System.Composition.Hosting.CompositionHost compositionHost, Microsoft.Extensions.Configuration.IConfiguration configuration, Microsoft.Extensions.Logging.ILogger logger) [0x00079] in <a906f848854547a083bd348961e348e4>:0 
[info]: OmniSharp.Stdio.Host
        Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.CSharpWorkspaceOptionsProvider
[info]: OmniSharp.Stdio.Host
        Configuration finished.
[info]: OmniSharp.Stdio.Host
        Omnisharp server running using Stdio at location '/Users/filip/Documents/dev/csharp-scripting-demos/build' on host 72438.

Updating VS Code to use OmniSharplatest (1.30.1-beta.15) or building from master branch fixes the problem.

Starting OmniSharp server at 2018-5-11 09:07:40
    Target: /Users/filip/Documents/dev/csharp-scripting-demos/build

OmniSharp server started with Mono 5.8.0
    Path: /Users/filip/.vscode/extensions/ms-vscode.csharp-1.15.0/.omnisharp/1.30.1-beta.15/omnisharp/OmniSharp.exe
    PID: 72635

[info]: OmniSharp.Stdio.Host
        Starting OmniSharp on MacOS 10.12.6 (x64)
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Located 2 MSBuild instance(s)
            1: Mono 15.0 - "/Library/Frameworks/Mono.framework/Versions/5.8.0/lib/mono/msbuild/15.0/bin"
            2: StandAlone 15.0 - "/Users/filip/.vscode/extensions/ms-vscode.csharp-1.15.0/.omnisharp/1.30.1-beta.15/omnisharp/msbuild/15.0/Bin"
[trce]: OmniSharp.Services.AssemblyLoader
        Assembly loaded from path: /Library/Frameworks/Mono.framework/Versions/5.8.0/lib/mono/msbuild/15.0/bin/Microsoft.Build.Utilities.Core.dll
[dbug]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Resolved 'Microsoft.Build.Utilities.Core' to '/Library/Frameworks/Mono.framework/Versions/5.8.0/lib/mono/msbuild/15.0/bin/Microsoft.Build.Utilities.Core.dll'
[trce]: OmniSharp.Services.AssemblyLoader
        Assembly loaded from path: /Library/Frameworks/Mono.framework/Versions/5.8.0/lib/mono/msbuild/15.0/bin/Microsoft.Build.Tasks.Core.dll
[dbug]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Resolved 'Microsoft.Build.Tasks.Core' to '/Library/Frameworks/Mono.framework/Versions/5.8.0/lib/mono/msbuild/15.0/bin/Microsoft.Build.Tasks.Core.dll'
[trce]: OmniSharp.Services.AssemblyLoader
        Assembly loaded from path: /Library/Frameworks/Mono.framework/Versions/5.8.0/lib/mono/msbuild/15.0/bin/Microsoft.Build.Framework.dll
[dbug]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Resolved 'Microsoft.Build.Framework' to '/Library/Frameworks/Mono.framework/Versions/5.8.0/lib/mono/msbuild/15.0/bin/Microsoft.Build.Framework.dll'
[trce]: OmniSharp.Services.AssemblyLoader
        Assembly loaded from path: /Library/Frameworks/Mono.framework/Versions/5.8.0/lib/mono/msbuild/15.0/bin/Microsoft.Build.dll
[dbug]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Resolved 'Microsoft.Build' to '/Library/Frameworks/Mono.framework/Versions/5.8.0/lib/mono/msbuild/15.0/bin/Microsoft.Build.dll'
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Registered MSBuild instance: Mono 15.0 - "/Library/Frameworks/Mono.framework/Versions/5.8.0/lib/mono/msbuild/15.0/bin"
            CscToolPath = /Users/filip/.vscode/extensions/ms-vscode.csharp-1.15.0/.omnisharp/1.30.1-beta.15/omnisharp/msbuild/15.0/Bin/Roslyn
            CscToolExe = csc.exe
[trce]: OmniSharp.Services.AssemblyLoader
        Assembly loaded from path: /Users/filip/Documents/omnisharp-ext/DiacriticRemoverDotNext.dll
[trce]: OmniSharp.Services.AssemblyLoader
        Assembly loaded from path: /Users/filip/Documents/omnisharp-ext/Roslynator.CSharp.Refactorings.dll
[trce]: OmniSharp.Services.AssemblyLoader
        Assembly loaded from path: /Users/filip/Documents/omnisharp-ext/Roslynator.Common.dll
[trce]: OmniSharp.Services.AssemblyLoader
        Assembly loaded from path: /Users/filip/Documents/omnisharp-ext/Roslynator.Core.dll
[trce]: OmniSharp.Services.AssemblyLoader
        Assembly loaded: Microsoft.CodeAnalysis.Features, Version=2.8.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
[trce]: OmniSharp.Services.AssemblyLoader
        Assembly loaded: Microsoft.CodeAnalysis.CSharp.Features, Version=2.8.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
[dbug]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Attempting to resolve 'Microsoft.CodeAnalysis.VisualBasic.Workspaces, Version=2.8.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
[dbug]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Attempting to resolve 'Microsoft.CodeAnalysis.VisualBasic.Features, Version=2.8.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
[trce]: OmniSharp.HostServicesAggregator
        Successfully added DiacriticRemoverDotNext, Version=1.0.6352.29906, Culture=neutral, PublicKeyToken=null to host service assemblies.
[trce]: OmniSharp.HostServicesAggregator
        Successfully added Roslynator.CSharp.Refactorings, Version=1.4.0.0, Culture=neutral, PublicKeyToken=33ae4d639eb665dc to host service assemblies.
[trce]: OmniSharp.HostServicesAggregator
        Successfully added Roslynator.Common, Version=1.4.0.0, Culture=neutral, PublicKeyToken=ba9e36134d755ccb to host service assemblies.
[trce]: OmniSharp.HostServicesAggregator
        Successfully added Roslynator.Core, Version=1.4.0.0, Culture=neutral, PublicKeyToken=83fd7bf6b74c2187 to host service assemblies.
[trce]: OmniSharp.HostServicesAggregator
        Successfully added Microsoft.CodeAnalysis.Features, Version=2.8.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35 to host service assemblies.
[trce]: OmniSharp.HostServicesAggregator
        Successfully added Microsoft.CodeAnalysis.CSharp.Features, Version=2.8.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35 to host service assemblies.
[info]: OmniSharp.Cake.CakeProjectSystem
        Detecting Cake files in '/Users/filip/Documents/dev/csharp-scripting-demos/build'.
[info]: OmniSharp.Cake.CakeProjectSystem
        Could not find any Cake files
[info]: OmniSharp.DotNet.DotNetProjectSystem
        Initializing in /Users/filip/Documents/dev/csharp-scripting-demos/build
[info]: OmniSharp.DotNet.DotNetProjectSystem
        Auto package restore: False
[info]: OmniSharp.DotNet.DotNetProjectSystem
        Update workspace context
[info]: OmniSharp.DotNet.DotNetProjectSystem
        Update project /Users/filip/Documents/dev/csharp-scripting-demos/build
[warn]: OmniSharp.DotNet.DotNetProjectSystem
        Cannot create any ProjectContext from project /Users/filip/Documents/dev/csharp-scripting-demos/build
[info]: OmniSharp.DotNet.DotNetProjectSystem
        Resolving projects references
[dbug]: OmniSharp.MSBuild.ProjectSystem
        MSBuild environment: 
Mode: Standalone
RunningTests: False
RunningInVisualStudio: False
MSBuildToolsDirectory32: /Library/Frameworks/Mono.framework/Versions/5.8.0/lib/mono/msbuild/15.0/bin
MSBuildToolsDirectory64: /Library/Frameworks/Mono.framework/Versions/5.8.0/lib/mono/msbuild/15.0/bin
MSBuildSDKsPath: /Library/Frameworks/Mono.framework/Versions/5.8.0/lib/mono/msbuild/15.0/bin/Sdks
CurrentMSBuildConfigurationFile: /Library/Frameworks/Mono.framework/Versions/5.8.0/lib/mono/msbuild/15.0/bin/MSBuild.dll.config
CurrentMSBuildExePath: /Library/Frameworks/Mono.framework/Versions/5.8.0/lib/mono/msbuild/15.0/bin/MSBuild.dll
CurrentMSBuildToolsDirectory: /Library/Frameworks/Mono.framework/Versions/5.8.0/lib/mono/msbuild/15.0/bin
VisualStudioInstallRootDirectory: 
MSBuildExtensionsPath: /Library/Frameworks/Mono.framework/Versions/5.8.0/lib/mono/msbuild/15.0/bin

[dbug]: OmniSharp.MSBuild.ProjectLoader
        'CscToolPath' set to '/Users/filip/.vscode/extensions/ms-vscode.csharp-1.15.0/.omnisharp/1.30.1-beta.15/omnisharp/msbuild/15.0/Bin/Roslyn'
[dbug]: OmniSharp.MSBuild.ProjectLoader
        'CscToolExe' set to 'csc.exe'
[info]: OmniSharp.MSBuild.ProjectSystem
        No solution files found in '/Users/filip/Documents/dev/csharp-scripting-demos/build'
[dbug]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Attempting to resolve 'System.Runtime.Loader, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
[info]: OmniSharp.Script.ScriptProjectSystem
        Detecting CSX files in '/Users/filip/Documents/dev/csharp-scripting-demos/build'.
[info]: OmniSharp.Script.ScriptProjectSystem
        Found 2 CSX files.
[info]: OmniSharp.Script.ScriptProjectSystem
        Searching for compilation dependencies with the fallback framework of 'net46'.
[info]: OmniSharp.Script.ScriptProjectSystem
        Unable to find dependency context for CSX files. Will default to non-context usage (Desktop CLR scripts).
[dbug]: OmniSharp.Services.MetadataFileReferenceCache
        Cache miss /Library/Frameworks/Mono.framework/Versions/5.8.0/lib/mono/4.5/mscorlib.dll
[dbug]: OmniSharp.Services.MetadataFileReferenceCache
        Cache miss /Library/Frameworks/Mono.framework/Versions/5.8.0/lib/mono/gac/System.Core/4.0.0.0__b77a5c561934e089/System.Core.dll
[dbug]: OmniSharp.Services.MetadataFileReferenceCache
        Cache miss /Library/Frameworks/Mono.framework/Versions/5.8.0/lib/mono/gac/System/4.0.0.0__b77a5c561934e089/System.dll
[dbug]: OmniSharp.Services.MetadataFileReferenceCache
        Cache miss /Library/Frameworks/Mono.framework/Versions/5.8.0/lib/mono/gac/System.ComponentModel.Composition/4.0.0.0__b77a5c561934e089/System.ComponentModel.Composition.dll
[dbug]: OmniSharp.Services.MetadataFileReferenceCache
        Cache miss /Library/Frameworks/Mono.framework/Versions/5.8.0/lib/mono/4.5/Facades/System.Runtime.dll
[dbug]: OmniSharp.Script.ScriptProjectSystem
        Adding implicit reference: /Users/filip/.vscode/extensions/ms-vscode.csharp-1.15.0/.omnisharp/1.30.1-beta.15/omnisharp/Microsoft.CodeAnalysis.dll
[dbug]: OmniSharp.Services.MetadataFileReferenceCache
        Cache miss /Users/filip/.vscode/extensions/ms-vscode.csharp-1.15.0/.omnisharp/1.30.1-beta.15/omnisharp/Microsoft.CodeAnalysis.dll
[dbug]: OmniSharp.Script.ScriptProjectSystem
        Added reference to '/Users/filip/.vscode/extensions/ms-vscode.csharp-1.15.0/.omnisharp/1.30.1-beta.15/omnisharp/Microsoft.CodeAnalysis.dll'
[dbug]: OmniSharp.Script.ScriptProjectSystem
        Adding implicit reference: /Users/filip/.vscode/extensions/ms-vscode.csharp-1.15.0/.omnisharp/1.30.1-beta.15/omnisharp/Microsoft.CodeAnalysis.CSharp.dll
[dbug]: OmniSharp.Services.MetadataFileReferenceCache
        Cache miss /Users/filip/.vscode/extensions/ms-vscode.csharp-1.15.0/.omnisharp/1.30.1-beta.15/omnisharp/Microsoft.CodeAnalysis.CSharp.dll
[dbug]: OmniSharp.Script.ScriptProjectSystem
        Added reference to '/Users/filip/.vscode/extensions/ms-vscode.csharp-1.15.0/.omnisharp/1.30.1-beta.15/omnisharp/Microsoft.CodeAnalysis.CSharp.dll'
[dbug]: OmniSharp.Script.ScriptProjectSystem
        Adding implicit reference: /Users/filip/.vscode/extensions/ms-vscode.csharp-1.15.0/.omnisharp/1.30.1-beta.15/omnisharp/Microsoft.CodeAnalysis.CSharp.Features.dll
[dbug]: OmniSharp.Services.MetadataFileReferenceCache
        Cache miss /Users/filip/.vscode/extensions/ms-vscode.csharp-1.15.0/.omnisharp/1.30.1-beta.15/omnisharp/Microsoft.CodeAnalysis.CSharp.Features.dll
[dbug]: OmniSharp.Script.ScriptProjectSystem
        Added reference to '/Users/filip/.vscode/extensions/ms-vscode.csharp-1.15.0/.omnisharp/1.30.1-beta.15/omnisharp/Microsoft.CodeAnalysis.CSharp.Features.dll'
[dbug]: OmniSharp.Script.ScriptProjectSystem
        Adding implicit reference: /Users/filip/.vscode/extensions/ms-vscode.csharp-1.15.0/.omnisharp/1.30.1-beta.15/omnisharp/Microsoft.CodeAnalysis.CSharp.Scripting.dll
[dbug]: OmniSharp.Services.MetadataFileReferenceCache
        Cache miss /Users/filip/.vscode/extensions/ms-vscode.csharp-1.15.0/.omnisharp/1.30.1-beta.15/omnisharp/Microsoft.CodeAnalysis.CSharp.Scripting.dll
[dbug]: OmniSharp.Script.ScriptProjectSystem
        Added reference to '/Users/filip/.vscode/extensions/ms-vscode.csharp-1.15.0/.omnisharp/1.30.1-beta.15/omnisharp/Microsoft.CodeAnalysis.CSharp.Scripting.dll'
[dbug]: OmniSharp.Script.ScriptProjectSystem
        Adding implicit reference: /Users/filip/.vscode/extensions/ms-vscode.csharp-1.15.0/.omnisharp/1.30.1-beta.15/omnisharp/Microsoft.CodeAnalysis.CSharp.Workspaces.dll
[dbug]: OmniSharp.Services.MetadataFileReferenceCache
        Cache miss /Users/filip/.vscode/extensions/ms-vscode.csharp-1.15.0/.omnisharp/1.30.1-beta.15/omnisharp/Microsoft.CodeAnalysis.CSharp.Workspaces.dll
[dbug]: OmniSharp.Script.ScriptProjectSystem
        Added reference to '/Users/filip/.vscode/extensions/ms-vscode.csharp-1.15.0/.omnisharp/1.30.1-beta.15/omnisharp/Microsoft.CodeAnalysis.CSharp.Workspaces.dll'
[dbug]: OmniSharp.Script.ScriptProjectSystem
        Adding implicit reference: /Users/filip/.vscode/extensions/ms-vscode.csharp-1.15.0/.omnisharp/1.30.1-beta.15/omnisharp/Microsoft.CodeAnalysis.Features.dll
[dbug]: OmniSharp.Services.MetadataFileReferenceCache
        Cache miss /Users/filip/.vscode/extensions/ms-vscode.csharp-1.15.0/.omnisharp/1.30.1-beta.15/omnisharp/Microsoft.CodeAnalysis.Features.dll
[dbug]: OmniSharp.Script.ScriptProjectSystem
        Added reference to '/Users/filip/.vscode/extensions/ms-vscode.csharp-1.15.0/.omnisharp/1.30.1-beta.15/omnisharp/Microsoft.CodeAnalysis.Features.dll'
[dbug]: OmniSharp.Script.ScriptProjectSystem
        Adding implicit reference: /Users/filip/.vscode/extensions/ms-vscode.csharp-1.15.0/.omnisharp/1.30.1-beta.15/omnisharp/Microsoft.CodeAnalysis.Scripting.dll
[dbug]: OmniSharp.Services.MetadataFileReferenceCache
        Cache miss /Users/filip/.vscode/extensions/ms-vscode.csharp-1.15.0/.omnisharp/1.30.1-beta.15/omnisharp/Microsoft.CodeAnalysis.Scripting.dll
[dbug]: OmniSharp.Script.ScriptProjectSystem
        Added reference to '/Users/filip/.vscode/extensions/ms-vscode.csharp-1.15.0/.omnisharp/1.30.1-beta.15/omnisharp/Microsoft.CodeAnalysis.Scripting.dll'
[dbug]: OmniSharp.Script.ScriptProjectSystem
        Adding implicit reference: /Users/filip/.vscode/extensions/ms-vscode.csharp-1.15.0/.omnisharp/1.30.1-beta.15/omnisharp/Microsoft.CodeAnalysis.Workspaces.Desktop.dll
[dbug]: OmniSharp.Services.MetadataFileReferenceCache
        Cache miss /Users/filip/.vscode/extensions/ms-vscode.csharp-1.15.0/.omnisharp/1.30.1-beta.15/omnisharp/Microsoft.CodeAnalysis.Workspaces.Desktop.dll
[dbug]: OmniSharp.Script.ScriptProjectSystem
        Added reference to '/Users/filip/.vscode/extensions/ms-vscode.csharp-1.15.0/.omnisharp/1.30.1-beta.15/omnisharp/Microsoft.CodeAnalysis.Workspaces.Desktop.dll'
[dbug]: OmniSharp.Script.ScriptProjectSystem
        Adding implicit reference: /Users/filip/.vscode/extensions/ms-vscode.csharp-1.15.0/.omnisharp/1.30.1-beta.15/omnisharp/Microsoft.CodeAnalysis.Workspaces.dll
[dbug]: OmniSharp.Services.MetadataFileReferenceCache
        Cache miss /Users/filip/.vscode/extensions/ms-vscode.csharp-1.15.0/.omnisharp/1.30.1-beta.15/omnisharp/Microsoft.CodeAnalysis.Workspaces.dll
[dbug]: OmniSharp.Script.ScriptProjectSystem
        Added reference to '/Users/filip/.vscode/extensions/ms-vscode.csharp-1.15.0/.omnisharp/1.30.1-beta.15/omnisharp/Microsoft.CodeAnalysis.Workspaces.dll'
[dbug]: OmniSharp.Script.ScriptProjectSystem
        Adding implicit reference: /Users/filip/.vscode/extensions/ms-vscode.csharp-1.15.0/.omnisharp/1.30.1-beta.15/omnisharp/System.ValueTuple.dll
[dbug]: OmniSharp.Services.MetadataFileReferenceCache
        Cache miss /Users/filip/.vscode/extensions/ms-vscode.csharp-1.15.0/.omnisharp/1.30.1-beta.15/omnisharp/System.ValueTuple.dll
[dbug]: OmniSharp.Script.ScriptProjectSystem
        Added reference to '/Users/filip/.vscode/extensions/ms-vscode.csharp-1.15.0/.omnisharp/1.30.1-beta.15/omnisharp/System.ValueTuple.dll'
[info]: OmniSharp.Script.ScriptProjectSystem
        Added CSX project '/Users/filip/Documents/dev/csharp-scripting-demos/build/build.csx' to the workspace.
[info]: OmniSharp.Script.ScriptProjectSystem
        Added CSX project '/Users/filip/Documents/dev/csharp-scripting-demos/build/references.csx' to the workspace.
[info]: OmniSharp.Stdio.Host
        Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.CSharpWorkspaceOptionsProvider
[info]: OmniSharp.Stdio.Host
        Configuration finished.
[info]: OmniSharp.Stdio.Host
        Omnisharp server running using Stdio at location '/Users/filip/Documents/dev/csharp-scripting-demos/build' on host 72438.

The problem doesn't happen on Windows.

@DustinCampbell @rchande I am not sure if this isn't some packaging problem in VS Code because I'd swear that release worked fine on macOS.
anyway, would it be possible to take the latest OmniSharp HEAD, with Roslyn 2.8.0 and release as 1.15.1 extension?

@filipw
Copy link
Member Author

filipw commented May 11, 2018

It really looks like a corrupt release.

  • using OmniSharp that ships with 1.15.0 extension - FAILS
  • using OmniSharp 1.30.0 from the release page - FAILS
  • manually building OmniSharp from the 1.30.0 tag in the repo - WORKS

@seesharper
Copy link
Contributor

Seeing the same behaviour on MacOS and Ubuntu. Windows seems fine

@filipw
Copy link
Member Author

filipw commented May 11, 2018

OK I have spent some more time analyzing the problem and while I have not fully understood what happened, the degree of udnerstanding has led me to producing a fix which is in PR #1185

What I wrote before is indeed true (and it affects not just macOS but also Linux)

  • running the OmniSharp bundled with 1.15.0 indeed causes C# Scripting to FAIL
  • same applies for manually downloading the release from releases page - also FAILS

Now, when building from the source, on macOS:

  • when just using msbuild (building into bin folder), it produces an OmniSharp executable that WORKS
  • but when building using the cake publish task, it still produces an OmniSharp executable that FAILS

The difference in this case is rather subtle and my understanding breaks down so it would have to be @DustinCampbell or @david-driscoll that could explain this better, what is really the difference here? This only happens when building on macOS. On Windows, the executable in both cases works fine.

Now, when I update my VS Code on Mac to "omnisharp.path":"latest", and it downloads latest build, everything works too. But it works not because it was fixed in any way, but because it downloads the OmniSharp build produced on AppVeyor on Windows (as opposed to the bundled package that came from Mac)!

Onto the core issue now.
What scripting project system does, is it will shared the OmniSharp's Roslyn assemblies with the project representing a C# script. This is by design - the script has to have access to CommandLineScriptGlobals which is defined in Roslyn. At the moment we do it using DependencyContext.Default, so technically by analyzing the OmniSharp.deps.json and picking up the pieces from there. This is excessive and as we see now, error prone, because in this case the whole failure is caused by an internal exception in the Microsoft.Extensions.DependencyModel, the library used to parse the deps.json. My guess was the root cause of the problem is how Mono deals with reference assemblies, because the failure happened not on the "real" DLL but on ".Reference" DLL.

SO to fix it once and for all, I have updated the code to pick up these Roslyn pieces from the current process (from current AppDomain) instead of looking at DependencyContext.Default and OmniSharp.deps.json. This frees us from any fluctations in the OmniSharp.deps.json or weird behaviors caused by the dependency tree parsing.

The PR was tested on both Linux and macOS and the problem has been fixed.

@DustinCampbell
Copy link
Contributor

@filipw, I have no idea why Cake's publish would be different. However, I'm definitely in favor of fewer dependency's on the OmniSharp.deps.json.

It seems to me that we should add a scripting test in C# for VS Code. Such a test would have failed on omnisharp-vscode's Travis runs. Do you want to take a stab at that? cc @rchande for help with this.

@filipw
Copy link
Member Author

filipw commented May 11, 2018

that's a very good idea - I will definitely have a look at that 👍

@rchande
Copy link

rchande commented May 11, 2018

@filipw Let me know if you need any help adding the test!

@DustinCampbell
Copy link
Contributor

Yes, let's definitely get a test added. Even something that just opens a csx file and verifies that signature help appears or something like that.

@DustinCampbell
Copy link
Contributor

@filipw: We have a new beta of C# for VS Code that includes your fix: https://github.com/OmniSharp/omnisharp-vscode/releases/tag/v1.15.2-beta1. Would you mind validating it to ensure the scripting issue is fixed?

@filipw
Copy link
Member Author

filipw commented May 11, 2018

thanks a lot, works perfectly 🔥

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

Successfully merging a pull request may close this issue.

4 participants