Enter authentication type (press enter for PAT) >
Enter personal access token > ****************************************************
Connecting to server ...
The type initializer for 'System.Net.Http.CurlHandler' threw an exception
I do not think this is not a duplicate of #110 because my OpenSSL version is 1.0.2h
Mac OS X 10.11.4
SGIs-Mac-mini:myagent clientuseme$ openssl version
OpenSSL 1.0.2h 3 May 2016
Is there something I am missing?
We have a couple users that even though they did the openssl update, net core is not loading it. I updated our macs to h and tried on all our mac versions (including 10.11.4 and 5). No problems. So we're trying to understand what's different. I may have to pull in some framework folks.
Is there anything else you can tell me about the machine? Did it ever have any of the dnx or net core dot net cli tools installed? Is it fairly fresh install of OSX? My macs for example are dev boxes so I went through the contribution guide instructions to install the tools - perhaps that's masking the issue. Etc...
It is a fairly fresh install as far as I know. I won't have access to it until Tuesday unfortunately. I can provide more information about it then.
I just tried to ./config.sh on a personal mac and it ran without any errors. This mac is running
$ openssl version
OpenSSL 1.0.2h 3 May 2016
and Mac OS X 10.10.5.
This personal mac does not have dnx or net core stuff installed. It's mostly used for photos/internet etc. I just installed homebrew, xcode and updated openssl just now.
Is there a specific report or log you need?
Thanks for the info. I'm trying to figure out what's different.
Just to confirm, it worked on the personal one and it didn't have dnx or net core. Would love to figure out what's different. I will likely have to escalate to net core team to figure out what we need to gather.
Here's the stack from the other customer. Can you look in _diag log and confirm you see the same stack?
[2016-06-01 23:06:50Z ERR Terminal] System.TypeInitializationException: The type initializer for 'System.Net.Http.CurlHandler' threw an exception. ---> System.TypeInitializationException: The type initializer for 'Http' threw an exception. ---> System.TypeInitializationException: The type initializer for 'HttpInitializer' threw an exception. ---> System.TypeInitializationException: The type initializer for 'CryptoInitializer' 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.CryptoInitializer.EnsureOpenSslInitialized()
at Interop.CryptoInitializer..cctor()
Also look in ./bin - I see on mine:
-rwx------@ 1 bryanmac staff 65788 May 12 15:48 System.Security.Cryptography.Native.dylib
One more thing to try. replace your url
$ openssl s_client -connect youraccount.visualstudio.com:443
...
Verify return code: 0 (ok)
---
^C
Also, can you make sure you ran both commands? Fx team said this could happen if second one isn't run
brew install openssl
brew link --force openssl
For the other customer that had this issue, he had run both of those commands but the second one must not have succeeded. He ran the second one again and then it worked. I confirmed with the framework team that if it says it's the newer version but it still doesn't find the binary then the link step did not work for some reason. Try that again
I ran
brew link --force openssl
and it worked, I don't know why it didn't work last week since I did the same thing.
Anyway, I've provided the stack trace information if that helps in anyway.
Thanks for your help!
stack trace
[2016-06-02 15:51:47Z ERR Terminal] WRITE ERROR (exception):
[2016-06-02 15:51:47Z ERR Terminal] System.TypeInitializationException: The type initializer for 'System.Net.Http.CurlHandler' threw an exception. ---> System.TypeInitializationException: The type initializer for 'Http' threw an exception. ---> System.TypeInitializationException: The type initializer for 'HttpInitializer' threw an exception. ---> System.TypeInitializationException: The type initializer for 'CryptoInitializer' 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.CryptoInitializer.EnsureOpenSslInitialized()
at Interop.CryptoInitializer..cctor()
--- End of inner exception stack trace ---
at Interop.CryptoInitializer.Initialize()
at Interop.HttpInitializer..cctor()
--- End of inner exception stack trace ---
at Interop.HttpInitializer.Initialize()
at Interop.Http..cctor()
--- End of inner exception stack trace ---
at Interop.Http.GetSupportedFeatures()
at System.Net.Http.CurlHandler..cctor()
--- End of inner exception stack trace ---
at System.Net.Http.CurlHandler..ctor()
at System.Net.Http.HttpClientHandler..ctor()
at Microsoft.VisualStudio.Services.Common.VssHttpMessageHandler..ctor(VssCredentials credentials, VssHttpRequestSettings settings)
at Microsoft.VisualStudio.Services.Client.VssConnection..ctor(Uri baseUrl, VssCredentials credentials, VssClientHttpRequestSettings settings)
at Microsoft.VisualStudio.Services.Agent.Util.ApiUtil.CreateConnection(Uri serverUri, VssCredentials credentials)
at Microsoft.VisualStudio.Services.Agent.Listener.Configuration.ConfigurationManager.<TestConnectAsync>d__11.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.VisualStudio.Services.Agent.Listener.Configuration.ConfigurationManager.<ConfigureAsync>d__8.MoveNext()
[2016-06-02 15:51:47Z ERR Terminal] WRITE ERROR: Failed to connect. Try again or ctrl-c to quit
inside ./bin I do see
System.Security.Cryptography.Native.dylib
openssl client did return 0
OK. Thanks for the update. the other customer had the same experience. I wonder if it silently didn't work the first time.
I'll update the docs to say try again if it still didn't work
Earlier versions were working for me (mac), however recent release is throwing the same error.
I had to install brew openssl and point the /usr/bin/openssl to that to resolve the issue.
But what has changed from previous releases to current release which is breaking this, we might need to investigate
Nothing changed. This is a net core requirement for their networking stack - not an agent requirement.
had the same issue, on ubuntu 16, resolved by > apt-get install libcurl4-openssl-dev
@knowling - did you need that to run or to build (dev) the agent.
On Ubuntu 14.04 I had the same issue and resolved by using apt-get install libcurl4-openssl-dev
@vkanne-msft - Thanks! - I'll update the docs
Invoke-WebRequest : The type initializer for 'System.Net.Http.CurlHandler' threw an exception.
At line:1 char:1
It seems to be related to the latest version of brew. Link command does not work for OpenSSL saying:
Warning: Refusing to link: openssl
Linking keg-only openssl means you may end up linking against the insecure,
deprecated system OpenSSL while using the headers from Homebrew's openssl.
The resolution is the following:
brew update
brew install openssl
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/
After these steps, dotnet core restore works as expected and no more type initialization errors...
Linking the new libs was needed as canbilgin states above.
brew link --force openssl
Warning: Refusing to link: openssl
Linking keg-only openssl means you may end up linking against the insecure,
deprecated system OpenSSL while using the headers from Homebrew's openssl.
Instead, pass the full include/library paths to your compiler e.g.:
-I/usr/local/opt/openssl/include -L/usr/local/opt/openssl/lib
going to try it in a nix env
@aljones15 - did you try the latest version of the agent in releases? It doesn't need the os update of openssl
ok will try and thanks for the speedy response
that worked have a new one:
Enter personal access token > ****************
Connecting to server ...
./config.sh: line 29: 3096 Segmentation fault: 11 ./bin/Agent.Listener configure "$@"
the above one is an existing issue I replaced the .dll and it worked. thanks for the help looks like I'm good.
@aljones15 which agent version you tried? is it 2.126.0?
also, you might want to undo the brew link --force openssl
@TingluoHuang @bryanmacfarlane Does not work any more:
Warning: Refusing to link macOS-provided software: openssl
If you need to have openssl first in your PATH run:
echo 'export PATH="/usr/local/opt/openssl/bin:$PATH"' >> ~/.zshrc
For compilers to find openssl you may need to set:
export LDFLAGS="-L/usr/local/opt/openssl/lib"
export CPPFLAGS="-I/usr/local/opt/openssl/include"
For pkg-config to find openssl you may need to set:
export PKG_CONFIG_PATH="/usr/local/opt/openssl/lib/pkgconfig"
And probably for a good reason.
Most helpful comment
It seems to be related to the latest version of brew. Link command does not work for OpenSSL saying:
The resolution is the following:
brew updatebrew install opensslln -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/After these steps, dotnet core restore works as expected and no more type initialization errors...