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.

Blazor WebAssembly & Azure.Storage.Blobs upload freezing/hanging

See original GitHub issue

Describe the bug

When using the Azure.Storage.Blobs package from Blazor wasm to upload files to blob storage the application is freezing, even though the upload succeeds to the blob storage endpoint (files can be then be retrieved to ensure they’ve been written correctly).

There is a difference in behaviour if the result of the UploadAsync is awaited or not (see code extract below). If it’s awaited, the first file in the files collection will be successfully written to blob storage - but then the UI will freeze. If the result is not awaited all the files in the collection will be successfully written to blob storage, then the UI will freeze.

To Reproduce

What steps can we follow to reproduce the issue?

Using Azure.Storage.Blobs nuget package (12.2.0)

BlobServiceClient service = new BlobServiceClient(<blob_connection_string>);
BlobContainerClient container = service.GetBlobContainerClient(<blob_container>);
foreach (var file in _files)
{
   var blobClient = container.GetBlobClient(file.Name);
   // get file stream (ms)...
   
   // This will successfully upload the file to blob storage, but then hang on the first file
   await blobClient.UploadAsync(ms, overwrite: true);

   // If you don't await the result like the below-  all files will will successfully upload to blob storage, then it will hang
   blobClient.UploadAsync(ms, overwrite: true, System.Threading.CancellationToken.None);
}

Full sample here: https://github.com/daltskin/BlazorFile2Azure/blob/blobsdk/Client/Pages/UploadFileDirect.razor

WASM debugging exception: Exception: ErrnoError error: 44 message: “FS error” node: undefined name: “Azure.Storage.Blobs.dll” blazorblob

Further technical details

  • ASP.NET Core version: 3.1.200-preview-014883 – Blazor v3.2.0-preview1.20073.1

  • Include the output of dotnet --info OS Name: Windows OS Version: 10.0.18363 OS Platform: Windows RID: win10-x64 Base Path: C:\Program Files\dotnet\sdk\3.1.200-preview-014883\

  • Visual Studio 2019 Preview 16.5.0 Preview 2.0

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
javiercncommented, Feb 6, 2020

@daltskin thanks for contacting us.

I believe this is likely caused by the library internally doing .Wait() or similar. That normally doesn’t cause issues as in most cases there is a separate thread that can resume the execution and unblock the waiting thread.

In the Blazor case, there is only a single thread, so if the library blocks internally, or does something that is not totally correct with the thread management, then it is likely to block the UI completely and given that Blazor is single threaded, there’s no other thread to notify the blocked thread and resume the execution.

@danroth27 this is external, can you follow up with someone on the SDK team to get to the root of this?

0reactions
mkArtakMSFTcommented, Apr 27, 2020

Ok, filed a separate issue in the Azure SDK repo to track this: https://github.com/Azure/azure-sdk-for-net/issues/11626

Read more comments on GitHub >

github_iconTop Results From Across the Web

Uploading file from Blazor WebAssembly App directly to ...
If you want to directly upload file to Azure blob in Blazor WebAssembly application, we need to configure CORS fro Azure storage account....
Read more >
Simple Steps to Upload Blazor Files to Azure Blob Storage
This article provides the step-by-step procedures to upload files to Azure Blob Storage using the Syncfusion Blazor File Upload component.
Read more >
Upload Files to Azure with .NET Core Web API and Blazor ...
Let's learn how to upload files to Azure using ASP.NET Core Web API as a server and Blazor WebAssembly as a client app....
Read more >
Upload a blob with .NET - Azure Storage
This article shows how to upload a blob using the Azure Storage client library for .NET. You can upload data to a block...
Read more >
Upload and Delete Files in Azure Blob Storage Using ...
Upload and Delete Files in Azure Blob Storage Using Blazor App with .NET 7 ; public async Task<bool> ; DeleteFileToBlobAsync(string ; ) {...
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