question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error while downloading file

See original GitHub issue

Hello. I encountered an error when downloading large files. File is not fully downloaded error occurs

'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Net.Http.resources\v4.0_4.0.0.0b03f5f7f11d50a3a\System.Net.Http.resources.dll'. Module was built without symbols.
Exception thrown: 'System.IO.IOException' in System.Net.Http.dll
Exception thrown: 'System.IO.IOException' in mscorlib.dll

The impression is that the server is disconnected because the file transfer takes longer.

Using code:

private async Task DownloadFile(DropboxClient client, string filePath, string localFilePath)
{
  using (var response = await client.Files.DownloadAsync(filePath))
  {
    using (var fileStream = File.Create(localFilePath))
    {
      response.GetContentAsStreamAsync().Result.CopyTo(fileStream);
    }
  }
}

Also an error occurs if you simultaneously download two or more files.

I hope for help in this matter.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
greg-dbcommented, Oct 3, 2018

@GitHubUniverse Thanks for the additional output! It looks like this may be due to a timeout. Please try setting longer timeouts like the example here:

https://github.com/dropbox/dropbox-sdk-dotnet/blob/master/dropbox-sdk-dotnet/Examples/SimpleTest/Program.cs#L68

0reactions
GitHubUniversecommented, Oct 4, 2018

@GitHubUniverse Thanks for the additional output! It looks like this may be due to a timeout. Please try setting longer timeouts like the example here:

https://github.com/dropbox/dropbox-sdk-dotnet/blob/master/dropbox-sdk-dotnet/Examples/SimpleTest/Program.cs#L68

@greg-db Thank you very much.

Now download works correctly. I can easily download files.

I added the reference to System.Net.Http.WebRequest, and made a change to the download method, adding from an example:

  var httpClient = new HttpClient(new WebRequestHandler { ReadWriteTimeout = 10 * 1000 })
  {
    Timeout = TimeSpan.FromMinutes(20)
  };

  var config = new DropboxClientConfig("SimpleTestApp")
  {
    HttpClient = httpClient
  };
  DropboxClient dropboxClient = new DropboxClient(token, config)

And also your example is working correctly.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Fix file download errors - Google Chrome Help
To fix the error: Cancel the download and try again. Instead of clicking the file to download, right-click the link and select Save...
Read more >
8 Ways to Fix the “Download Failed Network Error” on ...
8 Ways to Fix the “Download Failed Network Error” on Chrome · 1. Check Your Internet Speed and Connection · 2. Modify Your...
Read more >
While downloading getting errors (Failed
All files I have downloaded successfully all zipped files except 5 files numbers 257, 259, 260, 262, 263. When download process (using google ......
Read more >
How to Fix a Download Failed Network Error in Chrome
Another thing you can do to fix a download failed network error is reset Chrome and restore it to its default settings. Resetting...
Read more >
How to Fix the "Download Failed Network Error" Issue in ...
To fix a failed download in Chrome, ensure your internet connection is working, reboot your computer, save your file in a different location...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found