await CloudBlockBlob.UploadFromStreamAsy nc() never resumes

Hi,

Here is the snippet of the code, most of the time UploadFromStreamAsync never returns and does not continue executing rest of the code after that call. It works sometime, if i debug line by line.

  CloudBlockBlob cloudBlockBlob = container.GetBlockBlobReference(blobName);

 AccessCondition accessCondition = AccessCondition.GenerateIfNoneMatchCondition("*");

await cloudBlockBlob.UploadFromStreamAsync(data, accessCondition,  null, null, token);

Is anyone had this issue and what is the solution, I am using the latest storage package library

September 12th, 2015 4:42pm

Hi,

It looks like a common deadlock issue as described here - http://blog.stephencleary.com/2012/07/dont-block-on-async-code.html

The reason it deadlocks is because await (by default) will capture the current "context" - Then, when the operation completes, it will resume the async method within that context.

You might want to take a look at this article on Async Best Practices and refer to a similar discussion here - http://stackoverflow.com/questions/28450881/azure-cloudblockblob-downloadtextasync-in-asp-net-web-api-project-never-return might be helpful.

Best Regards

Sadiqh Ahmed

________________________________________________________________________________________________________________

If a post answers your question, please click Mark As Answer on that post and Vote as Helpful.

Free Windows Admin Tool Kit Click here and download it now
September 13th, 2015 2:42am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics