Details
-
Task
-
Resolution: Works as Designed
-
Minor - P4
-
None
-
2.4.1
-
MS Windows 10 x64, MongoDB 3.2,3.4, .Net Framework 4.5
Description
Hello,
I don't know is this a bug or a feature, but in fact it is very annoying thing.
If you try to connect to a MongoDB server with a wrong login\password or an another incorrect property that prevents establishing of a successful connection, an instance of MongoServer class will attempt to connect to the server while the process active.
var server = new MongoServer(anyWrongProps);
|
server.Connect(); // an exception should be raised here
|
After that the interminable loop
while (!heartbeatCancellationToken.IsCancellationRequested)
|
will be in progress in MongoServer.MonitorServerAsync() method.
I have tried to fix it with the following code
ClusterRegistry.Instance.UnregisterAndDisposeCluster(server.Cluster);
|
Seems it works, but perhaps it can be a reason of some problems. I don't know is this safe.
Best regards,
Alex