Uploaded image for project: 'C# Driver'
  1. C# Driver
  2. CSHARP-3431

Make MongoClient IDisposable

    • Type: Icon: New Feature New Feature
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 3.0.0
    • Affects Version/s: None
    • Component/s: Configuration
    • Needed
    • Hide

      1. What would you like to communicate to the user about this feature?
      The disposing logic has changed:
      We need to communicate the this feature is experimental, and calling dispose will not dispose the cluster and the underlying connections.
      Also after disposing any member access on MongoClient will throw ObjectDisposedException.

      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?

      Show
      1. What would you like to communicate to the user about this feature? The disposing logic has changed: We need to communicate the this feature is experimental, and calling dispose will not dispose the cluster and the underlying connections. Also after disposing any member access on MongoClient will throw ObjectDisposedException. 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?

      According to existing implementation the general advice on MongoClient usage is singleton lifetime scope.

      Lately several small issues (e.g. CSHARP-3424) arose which require per-instance use of MongoClient. This lifetime scope will result in excessive memory usage and undisposed resources.

      These small issues could be mitigated by making MongoClient IDisposable and changing the design accordingly to allow usage with short lifetime scope.

            Assignee:
            boris.dogadov@mongodb.com Boris Dogadov
            Reporter:
            mikalai.mazurenka@mongodb.com Mikalai Mazurenka (Inactive)
            Votes:
            3 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: