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
Mac OS: Unhandled Exception: System.TypeInitializationException #173
Comments
According to https://github.com/dotnet/cli/issues/1161, this happens when you don't have openssl installed. Did you follow the guide, especially the "Install pre-requisites" step? |
Yes, I did have openssl installed. It was working in 1.0.0.preview1-002702. [~] $ openssl version
OpenSSL 0.9.8zh 14 Jan 2016
[~] $ which openssl
/usr/bin/openssl |
@onecentlin @gguimaraesbr assuming you used Homebrew to install OpenSSL, it seems like you have only run one of the two commands. If you run The preview1 build could accidentally function without the link step, but we changed the library linking method for RTM (which is in the preview2 build of the sdk tools) to support loading copies from the current directory, which brought back the requirement of having symlinked the library into a system path. The openssl tool version after that step should be 1.0.2(and a letter); 0.9.8 is not supported. |
@bartonjs Thank you. This works!! After executing the command, now it works perfectly.
|
@onecentlin can you run |
@ascarter This is my openssl version and path.
|
@ascarter It's possible to have the |
Is there a particular reason why brew's version of OpenSSL is recommended (or required)? I am using MacPorts for all of my package management, and I can confirm that I am using the latest version of OpenSSL:
The opt-releated paths are set up correctly in my PATH settings and show up first (which is the default approach for MacPorts). Yet I'm getting the same error that others are reporting: Is the dotnet command line not able to utilize the PATH setting to locate the openssl files to use? EDIT: I have also symlinked the macports version of |
Thanks @bartonjs Symlinking the library did the trick. |
@mikeho $PATH is only for execution, and the openssl utility isn't actually used. What we need is libcrypto.1.0.0.dylib and libssl.1.0.0.dylib; and they need to be in a standard rpath probing location, which is any of Or you can try altering the DYLD_LIBRARY_PATH environment variable to include /opt/local/lib (which is where I assume MacPorts put it); but the Internet seems full of people who complain that DYLD_LIBRARY_PATH overrides aren't as successful as advertised on El Capitan. Personally, I'd just add symlinks in /usr/local/lib to those two libraries wherever MacPorts put them (unless MacPorts has a command similar to |
@bartonjs Thanks - I think you are exactly right. I install homebrew in |
@bartonjs looks like our messages got crossed over the wire. I actually did go ahead and symlink the macports version of |
@mikeho Intriguing. I don't suppose you can give me a primer on making my machine look like yours? (Like, how to get/use MacPorts, what options you've used (if applicable) and manual symlink commands you've done to try to remediate). |
@bartonjs never mind. I had actually used a non-version named file ( Adding the version numbers in the names fixed it. Thanks for your help! |
@mikeho Oh, good, I was concerned that the rules had somehow changed out from under me 😄. Glad it's working for you now! |
Okay, by my re-scan everyone who has chimed in has attained success; so I'm going to give a quick closing summary and close the issue: Resolution SummaryThe Homebrew users using default paths
The primary effect of this command is to create a symlink from /usr/local/lib/libcrypto.1.0.0.dylib to /usr/local/Cellar/openssl//lib/libcrypto.1.0.0.dylib (and similalry for libssl.1.0.0.dylib). It also links the openssl utility into /usr/local/bin, and creates other symlinks useful for building new libraries/applications against openssl. Other users (MacPorts, DIY, non-standard paths from Homebrew)You need to create versioned dylib symlinks from a standard library directory to wherever your installed copies are. For example:
Where the source path ( |
The stackoverflow / earlier version of openssl approach will cease working once you update brew (see Homebrew/brew#612). export DYLD_LIBRARY_PATH=/usr/local/opt/openssl/lib
dotnet new See https://developer.apple.com/library/mac/documentation/DeveloperTools/Conceptual/DynamicLibraries/100-Articles/DynamicLibraryUsageGuidelines.html#//apple_ref/doc/uid/TP40001928-SW21 for info on how the library search process works on OS X. |
I just had this issue, despite having My environment
What I did to fix this errorI ran the following:
Could this be related to the |
@KushalP - the Yes, |
I installed .NET Core 1.0 official installer released yesterday using this pkg (https://go.microsoft.com/fwlink/?LinkID=809124).
dotnet-dev-osx-x64.1.0.0-preview2-003121.pkg
Version: 1.0.0-preview2-003121
The text was updated successfully, but these errors were encountered: