omo_prodigi omo_prodigi - 9 months ago 118
ASP.NET (C#) Question

The type initializer for 'Crypto' threw an exception

I am running an ASP Core project on my linux box.

I have done very little on the boilerplate itself, save a few models built.

I tried running the project this morning and suddenly it breaks. Nothing works. I have snooped the internet for a couple of hours now but all to avail, because most of the users experiencing this issue are running in a mac system. See the stack trace below .

An unhandled exception has occurred: The type initializer for 'Crypto' threw an exception.
System.TypeInitializationException: The type initializer for 'Crypto' threw an exception. ---> System.DllNotFoundException: Unable to load DLL 'System.Security.Cryptography.Native.OpenSsl': 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.EvpMd5()
at Internal.Cryptography.HashProviderDispenser.CreateHashProvider(String hashAlgorithmId)
at System.Security.Cryptography.MD5.Implementation..ctor()
at Npgsql.FrontendMessages.PasswordMessage.CreateMD5(String password, String username, Byte[] serverSalt)
at Npgsql.NpgsqlConnector.ProcessAuthenticationMessage(String username, AuthenticationRequestMessage msg)
at Npgsql.NpgsqlConnector.HandleAuthentication(String username, NpgsqlTimeout timeout)
at Npgsql.NpgsqlConnector.Open(NpgsqlTimeout timeout)
at Npgsql.ConnectorPool.Allocate(NpgsqlConnection conn, NpgsqlTimeout timeout)
at Npgsql.NpgsqlConnection.OpenInternal()
at Microsoft.EntityFrameworkCore.Storage.RelationalConnection.Open()
at Microsoft.EntityFrameworkCore.Storage.Internal.NpgsqlDatabaseCreator.Exists()
at Microsoft.EntityFrameworkCore.Storage.RelationalDatabaseCreator.EnsureCreated()

Any possible ideas or solution

Answer Source

Had the question up for about 2 days ... got nothing.

Anyways , all i had to do was move to the NetCoreApp : 1.1.0 Version.

I installed the version and i was good :)

Thank you S.O.