You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When calling a DropboxClient to upload a file via a stream, the function has the side effect of closing the stream:
usingvardropbboxClient=new DropboxClient("apitoken");usingvarstream=new MemoryStream(Encoding.UTF8.GetBytes("a text file"));varrequest=new UploadArg("my new text file.txt");varresult=await dropbboxClient.Files.UploadAsync(request, stream);
stream.Seek(0, SeekOrigin.Begin);//Exception. Stream is closed
What happens:
dropbboxClient.Files.UploadAsync closes the stream after upload.
What should happen:
dropbboxClient.Files.UploadAsync should not close the stream. This is a hidden side effect that shouldn't happen.
Temporary Workaround:
Copy the stream into another stream.
AWS has some nice convenience features parallel to this with their s3 SDK.
The default of the sdk should be to NOT close the stream as this is a hidden side effect. However a nice enhancement would be to provide convenience properties in the class UploadArg of "AutoCloseStream" and "AutoResetStreamPosition" which can be set.
Thank you for reviewing.
The text was updated successfully, but these errors were encountered:
When calling a DropboxClient to upload a file via a stream, the function has the side effect of closing the stream:
What happens:
dropbboxClient.Files.UploadAsync closes the stream after upload.
What should happen:
dropbboxClient.Files.UploadAsync should not close the stream. This is a hidden side effect that shouldn't happen.
Temporary Workaround:
Copy the stream into another stream.
AWS has some nice convenience features parallel to this with their s3 SDK.
The default of the sdk should be to NOT close the stream as this is a hidden side effect. However a nice enhancement would be to provide convenience properties in the class UploadArg of "AutoCloseStream" and "AutoResetStreamPosition" which can be set.
Thank you for reviewing.
The text was updated successfully, but these errors were encountered: