" No AutoEncryption provider has been registered." with .NET

I’m attempting to use MongoDB’s Client Side Field Level Encryption feature. I have code in .NET 9 running on my Windows 11 machine that is attempting to a write a document with some encrypted fields to a MongoDB Atlas database. I have copied over the mongo_crypt_v1.dll file to a local folder - bin/crypt_shared/mongo_crypt_v1.dll and have specified the “cryptSharedLibPath” in the extraOptions when setting AutoEncryptionOptions. I’m however getting the following error -

Unhandled exception. MongoDB.Driver.MongoConfigurationException: No AutoEncryption provider has been registered.
at MongoDB.Driver.Encryption.AutoEncryptionProviderRegistry.CreateAutoCryptClientController(IMongoClient client, AutoEncryptionOptions autoEncryptionOptions)
at MongoDB.Driver.MongoClient…ctor(MongoClientSettings settings)

I have made sure that the program is able to access the mongo_crypt_v1.dll.

What am I missing?

I am having the same exact issue. Hopefully someone can give some guidance soon.

Ensure you’ve registered the following somewhere (and installed the MongoDB.Driver.Encryption nuget package):

MongoClientSettings.Extensions.AddAutoEncryption();