-
Type: Bug
-
Resolution: Duplicate
-
Priority: Unknown
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
Summary
.NET 7.0.14 Web API project. Previously using 2.22.0 of the library with no issues. Upon update to 2.23.0, initializing a new MongoClient now throws an ArgumentNullException message of "Value cannot be null. (Parameter 'factory')".
Please provide the version of the driver. If applicable, please provide the MongoDB server version and topology (standalone, replica set, or sharded cluster).
2.23.0 of the driver
How to Reproduce
- With a .NET 7 console app or WebAPI, and 2.23.0 of the driver from Nuget, instantiate a MongoClient using the connection string constructor with a valid connection string.
- Debug the application. At the point of client initialization .NET should throw an ArgumentNullException of "Value cannot be null. (Parameter 'factory')"
- Downgrade the driver to 2.22.0, and debug the application. Client will initialize correctly.
Additional Background
Downgrading back to 2.22.0 alleviates the issue. This seems like it's potentially an issue with Microsoft's ILogger, but it's hard to say. The MongoClient constructor signatures don't appear to have changed, or at the very least haven't changed to allow passing an initialized logger instance.
As this is the only dependency that I updated I'm inclined to think there might be something amiss in the library, but I wasn't able to find a changelog for 2.23.0 (still pretty fresh) so this is just a guess.
- duplicates
-
CSHARP-4870 CreateCluster throws NullReferenceException when not setting LoggingSettings
- Closed