Closed
Description
Describe the bug
WriteLineAsync method of HttpResponseStreamWriter in Asp.Net Core 3.0 can cause the following exception:
InvalidOperationException when attempting to write to the response body – with a message “Synchronous operations are disallowed. Call WriteAsync or set AllowSynchronousIO to true instead.”
.
I think it occurs, because default implementation on TextWriter creates new Task which calls Write method. This method is overriden in HttpResponseStreamWriter and writes to response stream in synchronous way. I guess it is a bug.
I've found an issue #2895 says this one and other methods should be overriden. But as I see, it is delayed.
Expected behavior
To work without setting AllowSynchronousIO = true
or using WriteAsync(line + "\n")