Need to see if your shared folder is taking up space on your dropbox 👨‍💻? Find out how to check here.

Forum Discussion

Opuscope's avatar
Opuscope
Helpful | Level 5
9 years ago
Solved

.Net SDK on UWP download stream sends empty buffers on read

Hi Dropbox dev community!   We're having a bit of a problem with the .Net SDK on our UWP app : we're using response.GetContentAsStreamAsync() after getting the path of a file on a dropbox account, ...
  • Greg-DB's avatar
    9 years ago

    We looked into this, and we believe the issue here is due to this possible behavior from Stream.Read:

     

     

    Return Value
    Type: System.Int32
    The total number of bytes read into the buffer. This can be less than the number of bytes requested if that many bytes are not currently available, or zero (0) if the end of the stream has been reached.

     

    That means that byteReadLength in the code snippet here won't always necessarilly be a whole 4 MB. The being the case, it looks like you'll need to make two changes:

    - when you write the data to the file, only write as much as byteReadLength

    - when you increment your downloadProgress, only add as much as byteReadLength

About Dropbox API Support & Feedback

Node avatar for Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.

The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.

If you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X, Facebook or Instagram.

For more info on available support options for your Dropbox plan, see this article.

If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!