dotnet restore (OSX)
See original GitHub issuedotnet new
dotnet restore
error: The type initializer for ‘System.Net.Http.CurlHandler’ threw an exception.
While this seems related to Curl, I also get an error in REPL
Console.WriteLine("Hello");
System.TypeInitializationException: The type initializer for 'Crypto' threw an exception. ---> System.DllNotFoundException: Unable to load DLL 'System.Security.Cryptography.Native': The specified module could not be found.
(Exception from HRESULT: 0x8007007E)
at Interop.Crypto.GetMaxMdSize()
at Interop.Crypto..cctor()
--- End of inner exception stack trace ---
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.ComputeSha1(Byte[] bytes)
at Microsoft.CodeAnalysis.AssemblyIdentity.CalculatePublicKeyToken(ImmutableArray`1 publicKey)
at Microsoft.CodeAnalysis.AssemblyIdentity.get_PublicKeyToken()
at Microsoft.CodeAnalysis.DesktopAssemblyIdentityComparer.Port(AssemblyIdentity identity)
at Microsoft.CodeAnalysis.DesktopAssemblyIdentityComparer.ApplyUnificationPolicies(AssemblyIdentity& reference, AssemblyIdentity& definition, AssemblyIdentityParts referenceParts, Boolean& isDefinitionFxAssembly)
at Microsoft.CodeAnalysis.AssemblyIdentityComparer.Compare(AssemblyIdentity reference, String referenceDisplayName, AssemblyIdentity definition, Boolean& unificationApplied, Boolean ignoreVersion)
at Microsoft.CodeAnalysis.CommonReferenceManager`2.ResolveMissingAssembly(AssemblyIdentity referenceIdentity, PortableExecutableReference peReference, MetadataImportOptions importOptions, DiagnosticBag diagnostics)
at Microsoft.CodeAnalysis.CommonReferenceManager`2.ResolveAndBindMissingAssemblies(TCompilation compilation, ImmutableArray`1 explicitAssemblies, ImmutableArray`1 explicitModules, ImmutableArray`1 explicitReferences, ImmutableArray`1 explicitReferenceMap, MetadataReferenceResolver resolver, MetadataImportOptions importOptions, Boolean supersedeLowerVersions, ArrayBuilder`1 referenceBindings, Dictionary`2 assemblyReferencesBySimpleName, ImmutableArray`1& allAssemblies, ImmutableArray`1& metadataReferences, ImmutableArray`1& resolvedReferences, DiagnosticBag resolutionDiagnostics)
at Microsoft.CodeAnalysis.CommonReferenceManager`2.Bind(TCompilation compilation, ImmutableArray`1 explicitAssemblies, ImmutableArray`1 explicitModules, ImmutableArray`1 explicitReferences, ImmutableArray`1 explicitReferenceMap, MetadataReferenceResolver resolverOpt, MetadataImportOptions importOptions, Boolean supersedeLowerVersions, Dictionary`2 assemblyReferencesBySimpleName, ImmutableArray`1& allAssemblies, ImmutableArray`1& implicitlyResolvedReferences, ImmutableArray`1& implicitlyResolvedReferenceMap, DiagnosticBag resolutionDiagnostics, Boolean& hasCircularReference, Int32& corLibraryIndex)
at Microsoft.CodeAnalysis.CSharp.CSharpCompilation.ReferenceManager.CreateAndSetSourceAssemblyFullBind(CSharpCompilation compilation)
at Microsoft.CodeAnalysis.CSharp.CSharpCompilation.ReferenceManager.CreateSourceAssemblyForCompilation(CSharpCompilation compilation)
at Microsoft.CodeAnalysis.CSharp.CSharpCompilation.BindScriptClass()
at System.Lazy`1.CreateValue()
at System.Lazy`1.LazyInitValue()
at Microsoft.CodeAnalysis.CSharp.CSharpCompilation.GetEntryPointAndDiagnostics(CancellationToken cancellationToken)
at Microsoft.CodeAnalysis.CSharp.CSharpCompilation.GetEntryPoint(CancellationToken cancellationToken)
at Microsoft.CodeAnalysis.CSharp.CSharpCompilation.CommonGetEntryPoint(CancellationToken cancellationToken)
at Microsoft.CodeAnalysis.Scripting.ScriptBuilder.Build[T](Compilation compilation, DiagnosticBag diagnostics, CancellationToken cancellationToken)
at Microsoft.CodeAnalysis.Scripting.ScriptBuilder.CreateExecutor[T](ScriptCompiler compiler, Compilation compilation, CancellationToken cancellationToken)
at Microsoft.CodeAnalysis.Scripting.Script`1.GetExecutor(CancellationToken cancellationToken)
at Microsoft.CodeAnalysis.Scripting.Script`1.CommonCompile(CancellationToken cancellationToken)
at Microsoft.CodeAnalysis.Scripting.Hosting.CommandLineRunner.TryBuildAndRun(Script`1 newScript, InteractiveScriptGlobals globals, ScriptState`1& state, ScriptOptions& options, CancellationToken cancellationToken)
at Microsoft.CodeAnalysis.Scripting.Hosting.CommandLineRunner.RunInteractiveLoop(ScriptOptions options, String initialScriptCodeOpt, CancellationToken cancellationToken)
at Microsoft.CodeAnalysis.Scripting.Hosting.CommandLineRunner.RunInteractiveCore(ErrorLogger errorLogger)
at Microsoft.CodeAnalysis.Scripting.Hosting.CommandLineRunner.RunInteractive()
at Microsoft.CodeAnalysis.CSharp.Scripting.Hosting.Csi.Main(String[] args)
Any ideas?
Issue Analytics
- State:
- Created 8 years ago
- Comments:16 (9 by maintainers)
Top Results From Across the Web
dotnet restore command - .NET CLI
Learn how to restore dependencies and project-specific tools with the dotnet restore command.
Read more >Is dotnet restore broken on macos?
1 Answer 1 ... This started happening for me recently as well (on macOS Big Sur 11.5.2, dotnet --version 5.0.100). I was seeing...
Read more >dotnet restore (from nuget) doesn't complete on M1 mac
I can repro it. This problem is regression with sdk7.0 from sdk6.0 , everything works as expected on sdk 6.0. So, if possible,...
Read more >Dotnet restore never completes on M1 Mac when targeting ...
I have an M1 macbook running Docker Desktop 4.14.1. I have created a dot net asp.net website project. When I build my image...
Read more >Cannot build image for linux/amd64 on M1 Mac - r/dotnet
Cannot build image for linux/amd64 on M1 Mac - dotnet restore fails. Hi,. I am trying to build a Docker image for linux/amd64...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Looks like this fixes the issue:
Credit goes to @davidfowl
And after installing openssl, you may also need to add soft links:
Refer to https://www.microsoft.com/net/core#macosx