Describe the bug
There is a defect or undocumented regression when migrating from 9.3.3 (NuGet package Microsoft.WindowsAzure.Storage) to 9.4.0+ (NuGet package Microsoft.Azure.Storage.Blob and Microsoft.Azure.Storage.Common).
This involves all of the synchronous upload endpoints as below:
Previously this worked as expected in both console applications and ASP.NET Web API. However, since 9.4.0, calls block endlessly.
This can be circumvented by wrapping in the following code, but should either be documented or fixed.
Task.Run(() => blockBlob.UploadFrom....()).Wait();
Exception or Stack Trace
No stack trace as error not produced, just blocks endlessly.
To Reproduce
Checkout the GitHub repository here and follow the steps to reproduce. It is using .NET 4.6.2 as this is where it was originally discovered.
https://github.com/deenairn/azureblobupload
Code Snippet
Code snippet from above repository. Check repo for more details and contact me if cannot reproduce or compile repo.
var storageAccount = CloudStorageAccount.Parse(storageAccountName);
var blobClient = storageAccount.CreateCloudBlobClient();
var container = blobClient.GetContainerReference(containerName);
container.CreateIfNotExists();
var fileName = Path.GetFileNameWithoutExtension(filepath);
var blockBlob = container.GetBlockBlobReference($"{fileName}-{nameof(UploadFromStream)}-{Guid.NewGuid()}");
var stream = File.OpenRead(filepath);
blockBlob.UploadFromStream(stream);
Expected behavior
A clear and concise description of what you expected to happen.
Screenshots
N/A
Setup (please complete the following information):
Additional context
N/A
Information Checklist
Kindly make sure that you have added all the following information above and checkoff the required fields otherwise we will treat the issuer as an incomplete report
Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @xgithub
Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @xgithub
Thanks, @deenairn. We'll look into adding a section in the v11 library's readme regarding async deadlocks.
The internal code problem is a sync-over-async situation imposed by the HttpClient. We've recently uncovered and addressed one class of issues with the recent v11 release (there were some awaits that didn't also use ConfigureAwait(false)).
Most helpful comment
Thanks, @deenairn. We'll look into adding a section in the v11 library's readme regarding async deadlocks.
The internal code problem is a sync-over-async situation imposed by the HttpClient. We've recently uncovered and addressed one class of issues with the recent v11 release (there were some awaits that didn't also use ConfigureAwait(false)).