Storage - UploadObjectAsync - "Synchronous operations are disallowed. Call ReadAsync or set AllowSynchronousIO to true instead." (.NET Core 3.0)
See original GitHub issueMuch like https://github.com/googleapis/google-api-dotnet-client/pull/1469, I’m getting:
Synchronous operations are disallowed. Call ReadAsync or set AllowSynchronousIO to true instead.
The stack trace I have is:
at Google.Cloud.Storage.V1.StorageClientImpl.UploadHelper.CheckFinalProgress()
at Google.Cloud.Storage.V1.StorageClientImpl.UploadHelper.ExecuteAsync(CancellationToken cancellationToken)
My guess is CheckFinalProgress
is finding and rethrowing an exception from elsewhere in the (comprehensively intimidating) upload infrastructure.
I’m on 2.4.0-beta3. After (a lot!) of paging through releases, I couldn’t see anything in the changelogs. In the meantime, I see there’s a 2.5.0 now, so I’ll update, and set AllowSynchronousIO=true
.
For others looking to make a one-off exception for a single request:
var syncIOFeature = HttpContext.Features.Get<IHttpBodyControlFeature>();
if (syncIOFeature != null)
{
syncIOFeature.AllowSynchronousIO = true;
}
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
ASP.NET Core : Synchronous operations are disallowed. ...
System.InvalidOperationException: Synchronous operations are disallowed. Call WriteAsync or set AllowSynchronousIO to true instead.
Read more >NET Core 3.0 AllowSynchronousIO Workaround
InvalidOperationException: Synchronous operations are disallowed. Call ReadAsync or set AllowSynchronousIO to true instead. at Microsoft.
Read more >Synchronous operations are disallowed. Call ReadAsync ...
I am setting up Sentry on asp.net Core and I am getting the following message: ... Call ReadAsync or set AllowSynchronousIO to true...
Read more >Synchronous operations are disallowed. Call ReadAsync or ...
Call ReadAsync or set AllowSynchronousIO to true instead. I could run the application with Visual Studio 2019 without any issue (on IIS Express) ......
Read more >Google Cloud Storage v1 API - Class StorageClient (4.6.0)
Creates a copy of an object synchronously, potentially to a different bucket. This method uses the rewriteObject underlying API operation ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Thanks for reporting this. I’ll have a look on Monday.
I have now, yes, thank you - all working as expected 😃