[CSHARP-4377] GridFSDownloadStream.Flush must not throw NotSupportedException Created: 22/Oct/22 Updated: 28/Oct/23 Resolved: 24/Nov/22 |
|
| Status: | Closed |
| Project: | C# Driver |
| Component/s: | GridFS |
| Affects Version/s: | None |
| Fix Version/s: | 2.19.0 |
| Type: | Bug | Priority: | Unknown |
| Reporter: | Robin Boerdijk | Assignee: | James Kovacs |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||
| Backwards Compatibility: | Minor Change | ||||||||
| Description |
SummaryThe Flush method of GridFSDownloadStream throws NotSupportedException. This is incorrect according to the .NET System.IO.Stream.Flush man page at https://learn.microsoft.com/en-us/dotnet/api/system.io.stream.flush?view=net-6.0. The man page states: "In a class derived from Stream that doesn't support writing, Flush is typically implemented as an empty method to ensure full compatibility with other Stream types since it's valid to flush a read-only stream." See below for a real-life case where this is a problem Please provide the version of the driver. If applicable, please provide the MongoDB server version and topology (standalone, replica set, or sharded cluster).2.17.1 How to ReproducePass a GridFSDownloadStream as input stream to a .NET CryptoStream in read mode. The CryptoStream's Dispose() method calls Flush() on the input stream, which causes the NotSupportedException to be thrown. Additional BackgroundPlease provide any additional background information that may be helpful in diagnosing the bug. |
| Comments |
| Comment by Githook User [ 24/Nov/22 ] |
|
Author: {'name': 'James Kovacs', 'email': 'jkovacs@post.harvard.edu', 'username': 'JamesKovacs'}Message: |