none
An unhandled exception of type 'System.StackOverflowException' occurred in Microsoft.WindowsAzure.Storage.dll

    Question

  • I am presently working with windows 10 universal application, here i am working with azure storage.

    I am getting above error when i downloading file file from windows azure storage.

    Here is my download code:

    private async Task<int> DownloadFromAzureStorage()
    {
       try
         {
         //  create Azure Storage
         CloudStorageAccount storageAccount = CloudStorageAccount.Parse("DefaultEndpointsProtocol=https;AccountName=<myaccname>;AccountKey=<mykey>");
    
         //  create a blob client.
         CloudBlobClient blobClient = storageAccount.CreateCloudBlobClient();
    
         //  create a container 
         CloudBlobContainer container = blobClient.GetContainerReference("sample");
    
         await container.CreateIfNotExistsAsync();
    
        //  create a block blob
        CloudBlockBlob blockBlob = container.GetBlockBlobReference("abc.jpg");
    
        FileSavePicker openPicker = new FileSavePicker();
        openPicker.SuggestedStartLocation = PickerLocationId.PicturesLibrary;
        openPicker.FileTypeChoices.Add("File", new List<string>() { ".jpg" });
        openPicker.SuggestedFileName = "New Documents";
        var imgFile = await openPicker.PickSaveFileAsync();
    
        await blockBlob.DownloadToFileAsync(imgFile); **//Error occuring in this line**
        return 1;
        }
        catch
         {
           //  return error
           return 0;
         }
       }

    File Uploading to my azure storage is success, but when i download to my uploaded my it showing the error is "An unhandled exception of type 'System.StackOverflowException' occurred in Microsoft.WindowsAzure.Storage.dll" in await blockBlob.DownloadToFileAsync(imgFile); Line

    please help me to resolve this issue..


    Devi Prasad.P

    Thursday, June 2, 2016 1:26 PM

All replies

  • Hi,

    Thank you for posting here!

    This is a known issue with the DownloadToFileAsync() method in the Win10 Universal Storage Client (unfortunately). The bug is fixed in the current preview release (7.0.2-preview), and will be fixed in an upcoming non-preview release. To fix your issue for now, please change your DownloadToFile call to the following:

    await blockBlob.DownloadToFileAsync(imgFile, null, null, null, CancellationToken.None);

    Regards,

    Vikranth S.

    Thursday, June 16, 2016 9:09 AM
    Moderator