Ubuntu 22.04 + Jetbrains Rider cannot run integration tests
Asked Answered
F

2

5

Hello i'm a new user of ubuntu (installed version 22.04) and i have problems with it from the start... Currently i am struggling with running integration tests with Jetbrains Rider (I run the application without any problems and connect to this database).

The error that i have is:

A connection was successfully established with the server, but then an error occurred during the pre-login handshake. (provider: TCP Provider, error: 35 - An internal exception was caught)

System.Security.Authentication.AuthenticationException
at System.Net.Security.SslStream.ForceAuthenticationAsync[TIOAdapter](TIOAdapter adapter, Boolean receiveFirst, Byte[] reAuthenticationData, Boolean isApm)
at System.Net.Security.SslStream.ProcessAuthentication(Boolean isAsync, Boolean isApm, CancellationToken cancellationToken)
at System.Net.Security.SslStream.AuthenticateAsClient(SslClientAuthenticationOptions sslClientAuthenticationOptions)
at System.Net.Security.SslStream.AuthenticateAsClient(String targetHost, X509CertificateCollection clientCertificates, SslProtocols enabledSslProtocols, Boolean checkCertificateRevocation)
at System.Net.Security.SslStream.AuthenticateAsClient(String targetHost)
at System.Data.SqlClient.SNI.SNITCPHandle.EnableSsl(UInt32 options)

System.TypeInitializationException
The type initializer for 'SslMethods' threw an exception.
at Interop.OpenSsl.AllocateSslContext(SslProtocols protocols, SafeX509Handle certHandle, SafeEvpPKeyHandle certKeyHandle, EncryptionPolicy policy, SslAuthenticationOptions sslAuthenticationOptions)
at System.Net.Security.SafeDeleteSslContext..ctor(SafeFreeSslCredentials credential, SslAuthenticationOptions sslAuthenticationOptions)
at System.Net.Security.SslStreamPal.HandshakeInternal(SafeFreeCredentials credential, SafeDeleteSslContext& context, ReadOnlySpan`1 inputBuffer, Byte[]& outputBuffer, SslAuthenticationOptions sslAuthenticationOptions)

System.TypeInitializationException
The type initializer for 'Ssl' threw an exception.
at Interop.Ssl.SslV2_3Method()
at Interop.Ssl.SslMethods..cctor()

System.TypeInitializationException
The type initializer for 'SslInitializer' threw an exception.
at Interop.Ssl..cctor()

Interop+Crypto+OpenSslCryptographicException
error:0E076071:configuration file routines:MODULE_RUN:unknown module name
at Interop.SslInitializer..cctor()

Ubuntu 22.04, .dotnet 5.0.213, Rider 2022.1

Anyone encountered such a problem?

Fifi answered 25/4, 2022 at 15:24 Comment(2)
Looks like a certificate issue, maybe you're not trusting your server's certificateNickel
well maybe, but its weird coz i can connect by app or Rider database explorer so why i cant by tests?Fifi
S
19

This is probably due to the OpenSSL config. I had a simlar problem and resolved it with this command:

sed -i 's/openssl_conf = openssl_init/#openssl_conf = openssl_init/g' /etc/ssl/openssl.cnf 

See Commit on github and Github issue

for more details.

Seiter answered 6/5, 2022 at 7:28 Comment(7)
Wow that's it! It totally helps, thank you very much! It is my first time with ubuntu so i can't figure it out by myself :DFifi
Connecting to MSSQL in Ubuntu 22.04 and this solved the issue, thanksHoldback
Do I have to restart a service afterwards?Faris
Not that I can recall. You just need to reconnect to the database. This file is read by the JavaVM on demand.Seiter
Pretty strange problem, with efcore it was working, instead with Npgsql directly is was firing the error... Does anybody knows if this is originated by rider build or something else? Inside a docker container i didn't find any issue.Fewness
In Ubuntu 22 and resolved now. Thank you for muchCounterscarp
What does this command do?Counts
A
0

you can try to add to your connection string: Encrypt=False;TrustServerCertificate=True". Of course, that is an only a temporary solution and that can be made only for tests.

Acaricide answered 28/4, 2022 at 9:26 Comment(1)
I tried to use this in connection string but sadly, it didnt help :(Fifi

© 2022 - 2024 — McMap. All rights reserved.