GridFSForwardOnlyUploadStream not closing properly on .NET Standard 2+ when cast to Stream before calling Close

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Fixed
    • Priority: Major - P3
    • 2.7.1
    • Affects Version/s: 2.7.0
    • Component/s: GridFS
    • None
    • Environment:
      .NET Standard 2+
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Consider the following code:

      var dst = bucket.OpenUploadStream(srcFile.Name);
      srcFile.OpenRead().CopyTo(dst);
      // dst.Close(); // Correctly writes fs.files collection
      ((Stream)dst).Close(); // Does NOT write to fs.files collection{{}}

      Looks like it's missing Close() override for NETSTANDARD2_0 that'll close the wrapped stream?  GridFSUploadStreamCompat.cs Line 80

      This leads to some pretty difficult to diagnose issues when the stream is used in any number of generic libraries that works against the Stream interface.

       

              Assignee:
              Robert Stam
              Reporter:
              Peter Huang
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: