Skip to content

OmniSharp throws 'Crypto' exception on macOS 10.11 due openssl linking issue for .NET Core #676

@haakoo

Description

@haakoo

Environment data

dotnet --info output:

.NET Command Line Tools (1.0.0-preview2-003121)

Product Information:
Version: 1.0.0-preview2-003121
Commit SHA-1 hash: 1e9d529bc5

Runtime Environment:
OS Name: Mac OS X
OS Version: 10.11
OS Platform: Darwin
RID: osx.10.11-x64

VS Code version: Version 1.4.0 (1.4.0)

C# Extension version: 1.3.0

OpenSSL fix

I downloaded and installed .net core using the x64.pkg.
Because of the problem with OpenSSL (which sucks), I found a "correct" fix to get it working (https://github.com/dotnet/cli/issues/3964#issuecomment-236493536):

sudo install_name_tool -add_rpath /usr/local/opt/openssl/lib /usr/local/share/dotnet/shared/Microsoft.NETCore.App/1.0.0/System.Security.Cryptography.Native.dylib

After that I can use ´dotnet´command and I thought I was set.

Steps to reproduce

  1. run ´dotnet new´
  2. Open i VS Code

Expected behavior

Working intellisense

Actual behavior

No intellisense

OmniSharp Log:

[INFO] Starting OmniSharp at '/Users/haakoo/Development/omniTest'...
[INFO] Started OmniSharp from '/Users/haakoo/.vscode/extensions/ms-vscode.csharp-1.3.0/out/.omnisharp-coreclr/OmniSharp' with process id 3188...
OmniSharp: -s /Users/haakoo/Development/omniTest --hostPID 3176 DotNet:enablePackageRestore=false --stdio
[INFORMATION:OmniSharp.Startup] Omnisharp server running using Stdio at location '/Users/haakoo/Development/omniTest' on host 3176.
[INFORMATION:OmniSharp.DotNet.DotNetProjectSystem] Initializing in /Users/haakoo/Development/omniTest
[INFORMATION:OmniSharp.DotNet.DotNetProjectSystem] Auto package restore: False
[INFORMATION:OmniSharp.DotNet.DotNetProjectSystem] Update workspace context
[INFORMATION:OmniSharp.DotNet.DotNetProjectSystem] Update project /Users/haakoo/Development/omniTest
[INFORMATION:OmniSharp.DotNet.DotNetProjectSystem] Add project /Users/haakoo/Development/omniTest/project.json => cc4d7a84-5e0f-4961-b3c0-30e539a8be18
[INFORMATION:OmniSharp.DotNet.DotNetProjectSystem] Resolving projects references
[INFORMATION:OmniSharp.DotNet.DotNetProjectSystem] Processing [ProjectState] omniTest/.NETCoreApp,Version=v1.0
[INFORMATION:OmniSharp.DotNet.DotNetProjectSystem] Added 73 and removed 0 file references
[ERROR:OmniSharp.Startup] The project system 'DotNetProjectSystem' threw exception during initialization.
The type initializer for 'Crypto' threw an exception.
at Interop.Crypto.EvpSha1()
at Internal.Cryptography.HashProviderDispenser.CreateHashProvider(String hashAlgorithmId)
at System.Security.Cryptography.SHA1.Implementation..ctor()
at System.Security.Cryptography.SHA1.Create()
at Roslyn.Utilities.SHA1CryptoServiceProvider..ctor()
at Microsoft.CodeAnalysis.CryptographicHashProvider.TryGetAlgorithm(SourceHashAlgorithm algorithmId)
at Microsoft.CodeAnalysis.Text.SourceText.CalculateChecksum(Stream stream, SourceHashAlgorithm algorithmId)
at Microsoft.CodeAnalysis.Text.SourceText.From(Stream stream, Encoding encoding, SourceHashAlgorithm checksumAlgorithm, Boolean throwIfBinaryDetected)
at OmniSharp.DotNet.DotNetProjectSystem.UpdateSourceFiles(ProjectState state, IEnumerable1 sourceFiles) in /Users/travis/build/OmniSharp/omnisharp-roslyn/src/OmniSharp.DotNet/DotNetProjectSystem.cs:line 373 at OmniSharp.DotNet.DotNetProjectSystem.Update(Boolean allowRestore) in /Users/travis/build/OmniSharp/omnisharp-roslyn/src/OmniSharp.DotNet/DotNetProjectSystem.cs:line 129 at OmniSharp.Startup.Configure(IApplicationBuilder app, IServiceProvider serviceProvider, IOmnisharpEnvironment env, ILoggerFactory loggerFactory, ISharedTextWriter writer, IOmnisharpAssemblyLoader loader, IOptions1 optionsAccessor) in /Users/travis/build/OmniSharp/omnisharp-roslyn/src/OmniSharp.Host/Startup.cs:line 183
[INFORMATION:OmniSharp#MSBuild] No solution files found in '/Users/haakoo/Development/omniTest'
[INFORMATION:OmniSharp.Startup] Configuration finished.
[ERROR:Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware] An unhandled exception has occurred: A task was canceled.
[INFORMATION:OmniSharp.Middleware.LoggingMiddleware] /currentfilemembersastree: 500 629ms
[ERROR:Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware] An unhandled exception has occurred: A task was canceled.
[INFORMATION:OmniSharp.Middleware.LoggingMiddleware] /autocomplete: 500 312ms
[ERROR:Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware] An unhandled exception has occurred: A task was canceled.
[INFORMATION:OmniSharp.Middleware.LoggingMiddleware] /autocomplete: 500 14ms
[ERROR:Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware] An unhandled exception has occurred: A task was canceled.
[INFORMATION:OmniSharp.Middleware.LoggingMiddleware] /currentfilemembersastree: 500 7ms
[ERROR:Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware] An unhandled exception has occurred: A task was canceled.
[INFORMATION:OmniSharp.Middleware.LoggingMiddleware] /codecheck: 500 8ms
[ERROR:Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware] An unhandled exception has occurred: A task was canceled.
[INFORMATION:OmniSharp.Middleware.LoggingMiddleware] /codecheck: 500 10ms

Metadata

Metadata

Assignees

No one assigned

    Labels

    OmniSharpfixedFixed and available in the stable version of C# Extension.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions