Hello dropboxers,
I'm using Dropbox SDK for .NET v2 and I'm trying to download a file which has 60 MB and I get an AggregateException : {"A task was canceled."} :.I've tried also to download a folder which contains only documents (a few MB) and it works .
The method for download a file:
private async Task GetFileTask(string cloudPath, string localPath)
{
if (string.IsNullOrEmpty(cloudPath) || string.IsNullOrEmpty(localPath))
return;
try
{
var response = await dbxClient.Files.DownloadAsync(cloudPath);
System.IO.Stream responseAsstrin = await response.GetContentAsStreamAsync();
System.IO.FileStream fileStream = System.IO.File.Create(localPath, (int)responseAsstrin.Length);
// Initialize the bytes array with the stream length and then fill it with data
byte[] bytesInStream = new byte[responseAsstrin.Length];
responseAsstrin.Read(bytesInStream, 0, bytesInStream.Length);
// Use write method to write to the file specified above
fileStream.Write(bytesInStream, 0, bytesInStream.Length);
fileStream.Close();
}
catch (AggregateException ex)
{
string message = ex.Message;
}
}
Also for uploading large files.Same error.
Thanks
Am I missing something ?