sdk: Type initializer for 'Crypto' threw an exception

Steps to reproduce

brew upgrade brew install openssl brew link --force openssl dotnet new

Expected behavior

Should create a new dotnet app

Actual behavior

Environment data

dotnet --info output:

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 23 (5 by maintainers)

Most upvoted comments

execute ln -s /usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib /usr/local/lib/ ln -s /usr/local/opt/openssl/lib/libssl.1.0.0.dylib /usr/local/lib/

instead of ln -s /usr/local/Cellar/openssl/1.0.2h_1/lib/libcrypto.1.0.0.dylib /usr/local/lib ln -s /usr/local/Cellar/openssl/1.0.2h_1/lib/libssl.1.0.0.dylib /usr/local/lib

if you receive “File exists” message ln -sf will do the magic…

ln -sf /usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib /usr/local/lib/ ln -sf /usr/local/opt/openssl/lib/libssl.1.0.0.dylib /usr/local/lib/

Great news…

I saw some updated instructions on https://www.microsoft.com/net/core and with a bit of tweaking to where my precise home-brew dirs are located, things are now working…

echo $(brew --prefix)
# Use that path for ...
ln -s /path/to/homebrew/cellar/openssl/1.0.2h_1/lib/libcrypto.1.0.0.dylib /usr/local/lib/
ln -s /path/to/homebrew/cellar/openssl/1.0.2h_1/lib/libssl.1.0.0.dylib /usr/local/lib/

Did you have to uninstall and re-install afterwards? I"m still getting the same error:

Scotts-Mac-mini:local sdw$ ln -s /usr/local/cellar/openssl/1.0.2h_1/lib/libcrypto.1.0.0.dylib /usr/local/lib/ Scotts-Mac-mini:local sdw$ ln -s /usr/local/cellar/cellar/openssl/1.0.2h_1/lib/libssl.1.0.0.dylib /usr/local/lib/ Scotts-Mac-mini:local sdw$ cd lib Scotts-Mac-mini:lib sdw$ ls dtrace libicuio.a libicutest.dylib icu libicuio.dylib libicutu.57.1.dylib libcrypto.1.0.0.dylib libicule.57.1.dylib libicutu.57.dylib libicudata.57.1.dylib libicule.57.dylib libicutu.a libicudata.57.dylib libicule.a libicutu.dylib libicudata.a libicule.dylib libicuuc.57.1.dylib libicudata.dylib libiculx.57.1.dylib libicuuc.57.dylib libicui18n.57.1.dylib libiculx.57.dylib libicuuc.a libicui18n.57.dylib libiculx.a libicuuc.dylib libicui18n.a libiculx.dylib libssl.1.0.0.dylib libicui18n.dylib libicutest.57.1.dylib node_modules libicuio.57.1.dylib libicutest.57.dylib pkgconfig libicuio.57.dylib libicutest.a Scotts-Mac-mini:lib sdw$ dotnet new The type initializer for ‘Crypto’ threw an exception. Scotts-Mac-mini:lib sdw$