Timeout on resolve CompositeServerSelector: MongoDrive ReasonChanged: "ReportedPrimaryIsStale", State: "Disconnected"

Having this issue that seams to star after upgrade from M2 to M5:

A timeout occurred after 30000ms selecting a server using CompositeServerSelector
{ Selectors = WritableServerSelector, LatencyLimitingServerSelector{ AllowedLatencyRange = 00:00:00.0150000 }, OperationsCountServerSelector }. 
Client view of cluster state is 
{ ClusterId : "1", ConnectionMode : "ReplicaSet", Type : "ReplicaSet", State : "Connected", Servers : [
{
 ServerId: "{ ClusterId : 1, EndPoint : "Unspecified/OMITED-shard-00-00.dhjnl.mongodb.net:27017" }", EndPoint: "Unspecified/OMITED-shard-00-00.dhjnl.mongodb.net:27017", ReasonChanged: "Heartbeat", State: "Connected", ServerVersion: 6.0.0, TopologyVersion: { "processId" : ObjectId("6532d0b151a832fae55b80b1"), "counter" : NumberLong(4) }, Type: "ReplicaSetSecondary", Tags: "{ nodeType : ELECTABLE, region : US_EAST_1, provider : AWS, workloadType : OPERATIONAL }", WireVersionRange: "[0, 17]", LastHeartbeatTimestamp: "2023-11-16T16:33:07.4553464Z", LastUpdateTimestamp: "2023-11-16T16:33:07.4553466Z" }, 
 
 { ServerId: "{ ClusterId : 1, EndPoint : "Unspecified/OMITED-shard-00-01.dhjnl.mongodb.net:27017" }", EndPoint: "Unspecified/OMITED-shard-00-01.dhjnl.mongodb.net:27017", ReasonChanged: "Heartbeat", State: "Connected", ServerVersion: 6.0.0, TopologyVersion: { "processId" : ObjectId("6532d404eea41b5a2f662df1"), "counter" : NumberLong(3) }, Type: "ReplicaSetSecondary", Tags: "{ workloadType : OPERATIONAL, provider : AWS, nodeType : ELECTABLE, region : US_EAST_1 }", WireVersionRange: "[0, 17]", LastHeartbeatTimestamp: "2023-11-16T16:33:08.1949826Z", LastUpdateTimestamp: "2023-11-16T16:33:08.1949829Z" }, 
 
 { ServerId: "{ ClusterId : 1, EndPoint : "Unspecified/OMITED-shard-00-02.dhjnl.mongodb.net:27017" }", EndPoint: "Unspecified/OMITED-shard-00-02.dhjnl.mongodb.net:27017", ReasonChanged: "ReportedPrimaryIsStale", State: "Disconnected", ServerVersion: , TopologyVersion: , Type: "Unknown", LastHeartbeatTimestamp: null, LastUpdateTimestamp: "2023-11-16T16:33:03.3270509Z" }] }.

StackTrace:

at MongoDB.Driver.Core.Clusters.Cluster.ThrowTimeoutException(IServerSelector selector, ClusterDescription description)
   at MongoDB.Driver.Core.Clusters.Cluster.WaitForDescriptionChangedHelper.HandleCompletedTask(Task completedTask)
   at MongoDB.Driver.Core.Clusters.Cluster.WaitForDescriptionChangedAsync(IServerSelector selector, ClusterDescription description, Task descriptionChangedTask, TimeSpan timeout, CancellationToken cancellationToken)
   at MongoDB.Driver.Core.Clusters.Cluster.SelectServerAsync(IServerSelector selector, CancellationToken cancellationToken)
   at MongoDB.Driver.Core.Clusters.IClusterExtensions.SelectServerAndPinIfNeededAsync(ICluster cluster, ICoreSessionHandle session, IServerSelector selector, CancellationToken cancellationToken)
   at MongoDB.Driver.Core.Bindings.WritableServerBinding.GetWriteChannelSourceAsync(CancellationToken cancellationToken)
   at MongoDB.Driver.Core.Operations.RetryableWriteContext.InitializeAsync(CancellationToken cancellationToken)
   at MongoDB.Driver.Core.Operations.RetryableWriteContext.CreateAsync(IWriteBinding binding, Boolean retryRequested, CancellationToken cancellationToken)
   at MongoDB.Driver.Core.Operations.BulkMixedWriteOperation.ExecuteAsync(IWriteBinding binding, CancellationToken cancellationToken)
   at MongoDB.Driver.OperationExecutor.ExecuteWriteOperationAsync[TResult](IWriteBinding binding, IWriteOperation`1 operation, CancellationToken cancellationToken)
   at MongoDB.Driver.MongoCollectionImpl`1.ExecuteWriteOperationAsync[TResult](IClientSessionHandle session, IWriteOperation`1 operation, CancellationToken cancellationToken)
   at MongoDB.Driver.MongoCollectionImpl`1.BulkWriteAsync(IClientSessionHandle session, IEnumerable`1 requests, BulkWriteOptions options, CancellationToken cancellationToken)
   at MongoDB.Driver.MongoCollectionImpl`1.UsingImplicitSessionAsync[TResult](Func`2 funcAsync, CancellationToken cancellationToken)
   at MongoDB.Driver.MongoCollectionBase`1.UpdateOneAsync(FilterDefinition`1 filter, UpdateDefinition`1 update, UpdateOptions options, Func`3 bulkWriteAsync)
   at PillaOrder.Repositories.RequestRepository.UpdateStatusPaycheckAdvance(String orderId, String status, String description) in /home/vsts/work/1/s/src/PillaOrder.Repositories/RequestRepository.cs:line 111

Already tried a lots of things, read a lots of articles, nothing works

Hey @wiliam_buzatto,

Thank you for reaching out to MongoDB Community forums.

I suspect it might be related to the upgrade process, as there is a brief downtime when upgrading from M2 to M5. Please refer to the Modify a Cluster - documentation for more details.

Alternatively, this issue might also be related to one of the bugs we recently addressed, CSHARP-4001. A solution for CSHARP-4001 has been included in .NET/C# Driver 2.15.0. Please consider upgrading and let us if this resolves the problem.

If the issue persists, please share the MongoDB version, the driver version, and the code snippet you are executing, it will help the community to assist you better.

Best regards,
Kushagra