LibMongoCrypt fails to create client due to LibraryLoader exception

We are experiencing a degradation between version 2.15.1 and the latest 2.18.0 version.
We have upgraded both MongoDB.Driver and MongoDB.Driver.Core.

After upgrade, the ClientEncryption constructor crashes with the following stack trace:

MongoDB.Libmongocrypt.LibraryLoader+FunctionNotFoundException: mongocrypt_setopt_aes_256_ecb
   at MongoDB.Libmongocrypt.LibraryLoader.GetFunction[T](String name)
   at System.Lazy`1.ViaFactory(LazyThreadSafetyMode mode)
   at System.Lazy`1.ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor)
   at System.Lazy`1.CreateValue()
   at MongoDB.Libmongocrypt.CryptClientFactory.Create(CryptOptions options)
   at MongoDB.Driver.Encryption.ClientEncryption..ctor(ClientEncryptionOptions clientEncryptionOptions)

We initiate the ClientEncryption the following way:

var clientEncryptionOptions = new ClientEncryptionOptions(DataKeysMongoClient, _keyVaultNamespace, KmsProviders);

return new ClientEncryption(clientEncryptionOptions);

Where DataKeysMongoClient is a IMongoClient, _keyVaultNamespace is the collection namespace and KmsProviders is dictionary to hold the encryption relevant data.

Again, all of this worked properly in version 2.15.1 and started happening once we upgraded to the latest 2.18.0 version.
Any help will be very appreciated.

Hey @Ilia_Shkolyar , this error happens because the driver can’t find a method mongocrypt_setopt_aes_256_ecb in the embedded native C library called libmongocrypt.so/.dylib. This method was added in the 2.16 release and still presents in that library. So, it’s unclear why you see this exception. Can you please check that library (libmongocrypt.so - for linux, libmongocrypt.dylib - for macos) in a bin folder and do the following:
nm -g libmongocrypt.dylib | grep aes_256_ecb ?
Best regards, Dima