-
Notifications
You must be signed in to change notification settings - Fork 196
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
Synchronous operations are disallowed #649
Comments
Same here. Instead I use //await response.WriteAsJsonAsync(responseDTO); <-- dont work
var serialized = JsonConvert.SerializeObject(responseDTO);
var ms = new MemoryStream(Encoding.UTF8.GetBytes(serialized));
await response.Body.WriteAsync(ms.ToArray()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the issue
.net 8 Azure Function in program.cs when configuring .ConfigureFunctionsWebApplication(worker => worker.UseNewtonSoftJson()) I will get a an error "Synchronous operations are disallowed. Call WriteAsync or set AllowSynchronousIO to true instead"
That led me to this link.
The code:
}
It will bomb out on .WriteAsJsonAsync() from swagger and postman. It could be my object I am returning but..
My work around:
My work around was to remove worker => worker.UseNewtonSoftJson() from my config.
This works for swagger and json. It could be the object I am serializing that doesn't play nice with NewtonSoft. idk. The link make it seem like there's some other issue with flushing on write.¯_(ツ)_/¯.
The text was updated successfully, but these errors were encountered: