[CSHARP-4871] Client crashes when trying to initializing the mongoclient when setting clusterconfigurator Created: 15/Dec/23  Updated: 15/Dec/23  Resolved: 15/Dec/23

Status: Closed
Project: C# Driver
Component/s: API, Configuration, Logging
Affects Version/s: 2.23.0
Fix Version/s: None

Type: Bug Priority: Critical - P2
Reporter: Sasan Pasha Assignee: Unassigned
Resolution: Duplicate Votes: 0
Labels: Bug, crash
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
duplicates CSHARP-4870 CreateCluster throws NullReferenceExc... Closed
Documentation Changes Summary:

1. What would you like to communicate to the user about this feature?
2. Would you like the user to see examples of the syntax and/or executable code and its output?
3. Which versions of the driver/connector does this apply to?


 Description   

Summary

updated to the latest version 2.23.0 from 2.22.0. An exception is thrown during the call to

// code placeholder
_dbSettings1.ClusterConfigurator = builder =>
            {
                builder.Subscribe<ConnectionPoolAddedConnectionEvent>(e =>
               {
                   connectionAdded++;
                   //Console.WriteLine("Total Added Connections: " + connectionAdded);
               });
                builder.Subscribe<ConnectionPoolRemovedConnectionEvent>(e =>
               {
                   connectionRemoved++;
                   //Console.WriteLine("Total Removed Connections: " + connectionRemoved);
               });
            }; 
_mongoClient = new MongoClient(_dbSettings);

// code placeholder
Value cannot be null.
Parameter name: factory
Source: Microsoft.Extensions.Logging.Abstractions
Thread started: <Thread Pool> #21
  at Microsoft.Extensions.Logging.LoggerFactoryExtensions.CreateLogger[T] (Microsoft.Extensions.Logging.ILoggerFactory factory) [0x00003] in <d7a3ca84869f48e0aa5c354ee22cb1ee>:0 
  at MongoDB.Driver.Core.Clusters.ClusterFactory.<ProcessClusterEnvironment>g__LogIfExternalEnvironment|9_2 (System.String host, System.String environment, System.String documentationUrl, System.String[] suffixes) [0x00022] in <9a38b6dbb2264f9885b4250438ce22a4>:0 
  at MongoDB.Driver.Core.Clusters.ClusterFactory.<ProcessClusterEnvironment>g__LogIfCosmosDB|9_0 (System.String host) [0x00000] in <9a38b6dbb2264f9885b4250438ce22a4>:0 
  at MongoDB.Driver.Core.Clusters.ClusterFactory.ProcessClusterEnvironment (MongoDB.Driver.Core.Configuration.ClusterSettings settings) [0x0002b] in <9a38b6dbb2264f9885b4250438ce22a4>:0 
  at MongoDB.Driver.Core.Clusters.ClusterFactory.CreateCluster () [0x00007] in <9a38b6dbb2264f9885b4250438ce22a4>:0 
  at MongoDB.Driver.Core.Configuration.ClusterBuilder.BuildCluster () [0x00006] in <9a38b6dbb2264f9885b4250438ce22a4>:0 
  at MongoDB.Driver.ClusterRegistry.CreateCluster (MongoDB.Driver.ClusterKey clusterKey) [0x000cf] in <6926c8350547439997c522a25b1c60d3>:0 
  at MongoDB.Driver.ClusterRegistry.GetOrCreateCluster (MongoDB.Driver.ClusterKey clusterKey) [0x00021] in <6926c8350547439997c522a25b1c60d3>:0 
  at MongoDB.Driver.MongoClient..ctor (MongoDB.Driver.MongoClientSettings settings) [0x0003e] in <6926c8350547439997c522a25b1c60d3>:0  

Please provide the version of the driver. If applicable, please provide the MongoDB server version and topology (standalone, replica set, or sharded cluster).

the working version is 2.22.0

 



 Comments   
Comment by Boris Dogadov [ 15/Dec/23 ]

Thanks sasan.pasha@gmail.com,
We are aware of this issue and working on a fix.

Closing as a duplicate of CSHARP-4870

Comment by PM Bot [ 15/Dec/23 ]

Hi sasan.pasha@gmail.com, thank you for reporting this issue! The team will look into it and get back to you soon.

Generated at Wed Feb 07 21:49:38 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.