Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Blob upload fails when run in Blazor WebAssembly #11626

Closed
mkArtakMSFT opened this issue Apr 27, 2020 · 4 comments · Fixed by #11643
Closed

Blob upload fails when run in Blazor WebAssembly #11626

mkArtakMSFT opened this issue Apr 27, 2020 · 4 comments · Fixed by #11643
Assignees
Labels
Azure.Core Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that

Comments

@mkArtakMSFT
Copy link

Describe the bug
The UploadAsync call fails when run in Blazor WebAssembly. Here is my sample code:

public async Task UploadPayload(Stream payload)
{
  BlobClient client = new BlobClient("myConnectionString", "container", "bla");
  await client.UploadAsync(payload);
}

Expected behavior
The call succeeds

Actual behavior (include Exception or Stack Trace)
I get the following error:
System.Threading.SynchronizationLockException: Cannot wait on monitors on this runtime.

To Reproduce

  • Using latest VS 2019 preview (16.6 Preview 4)
  • Installed 3.1.3 SDK

Create a new Blazor WebAssembly application (3.2. Preview5 version):

  • dotnet new -i Microsoft.AspNetCore.Components.WebAssembly.Templates::3.2.0-preview5.20216.8
  • dotnet new blazorwasm
  • Add reference to <PackageReference Include="Azure.Storage.Blobs" Version="12.4.1" /> package
  • Update the Pages/Counter.razor as follows (Note: replace myConnectionString with a valid Blob storage connection string)
  • Run the app, go to the /counter page and click the Click Me button
@page "/counter"
@using Azure.Storage.Blobs
@using System.IO

<h1>Counter</h1>

<p>Current count: @currentCount</p>

<button class="btn btn-primary" @onclick="IncrementCount">Click me</button>

@code {
    private int currentCount = 0;

    private async Task IncrementCount()
    {
        using MemoryStream payload = new MemoryStream();
        using StreamWriter sr = new StreamWriter(payload);
        sr.WriteLine("Sample payload to upload");
        sr.Flush();
        payload.Position = 0;

// The above code is simply to simulate a payload
        BlobClient client = new BlobClient("myConnectionString", "container", "bla");
        await client.UploadAsync(payload);
    }
}

Environment:

  • Name and version of the Library package used: Azure.Storage.Blobs v.12.4.1

  • Hosting platform or OS and .NET runtime version (dotnet --info output for .NET Core projects): .NET Core Runtime: 3.1.3
    OS: Win 10 Pro x64

  • IDE and version : VS 16.6 Preview4

@ghost ghost added needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. customer-reported Issues that are reported by GitHub users external to the Azure organization. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that labels Apr 27, 2020
@pakrym pakrym self-assigned this Apr 27, 2020
@ghost ghost removed the needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. label Apr 27, 2020
@pakrym pakrym added the Client This issue points to a problem in the data-plane of the library. label Apr 27, 2020
@pakrym pakrym reopened this Apr 28, 2020
@pakrym
Copy link
Contributor

pakrym commented Apr 28, 2020

Confirmed fixed with a latest Azure.Core build.

@pakrym pakrym closed this as completed Apr 28, 2020
@mkArtakMSFT
Copy link
Author

Thank you so much for handling this so fast, @pakrym!
Any hints regarding when should I expect this fix to be released?

@pakrym
Copy link
Contributor

pakrym commented Apr 28, 2020

This Friday the Azure.Core would ship so customers would have a workaround of updating it. I'm not sure if storage would also ship with updated Azure.Core dependency but the probability is high.

@mkArtakMSFT is there an easy way to run our tests in blazor runtime?

@mkArtak
Copy link

mkArtak commented Apr 29, 2020

Unfortunately there is no easy way at the moment. We currently handle this manually, but the Mono team is working with the infrastructure team to spin up an internal hardware lab, where we will eventually be able to run automated tests against Mono WebAssembly runtime.

openapi-sdkautomation bot pushed a commit to AzureSDKAutomation/azure-sdk-for-net that referenced this issue Nov 23, 2020
[Hub Generated] Review request for Microsoft.MixedReality to add version preview/2019-02-28-preview (Azure#11626)

* add isDataAction to listOperations spec

* check if type is wrong

* Type should be boolean

* add identity and kind to the spatial accounts def

* isDataAction should be an enum

* move isDataAction to its own enum

* remove kind from list

* refer to common types instead of defining inline

* update schema to reflect reality

* remove extraneous curly brace

* add curly brace at the correct location

* change nameAvailable to boolean

* add a format for integer type

* change example

* updated wrong file

* remove format per breaking change discussion

* fix prettier error
@github-actions github-actions bot locked and limited conversation to collaborators Mar 28, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Azure.Core Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants