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.
To work without setting AllowSynchronousIO = true or using WriteAsync(line + "\n")
@javiercn FYI HttpAbstractions issues are tracked in area-servers, not hosting.
That would be a good reason to fix #2895.
We have a similar issue for the reading side
Let's tackle all this together. Closing this as a dupe of #2895