I have been running into an issue when trying to use RenderViewAsync to write to an HTTP Response Body output stream.
It seems like RenderViewAsync writes to the stream passed in Syncronously in some situations which causes issues with Kestral unless you set this flag
I have created some unit tests reproducing the bugs in this branch
I was also able to produce this bug in the MVC sample in this branch
Some things i have noticed with this bug:
It only happens when rendering values to nested views
IE a section rendered inside a _Layout file, although this does not happen with renderBody
It only happens when acutaly writing a value from the context, i can make a section very large and it will not do a sync write
This only seems to happen when writing string values greater than 128 (ie if my first name was 129 chars long)
Its related to the buffer size of the writer
If you have a buffer size of 1024 and you try and write a string that is 1025 chars long it will always force the error
While the bug happens is related to buffer size, you can hit thit bug while writing values lower than the buffer size.
I think that what probably happens here is that if you try and write a value and it forces you to write over the end of the buffer it will forec a sync write. But if your value size is bigger than the buffer this always happens
-I think that the default buffer size in the ASP.NET is bigger than 1024 (probably 4096) because the value needs to be much larger to force this error every time there but it is still possible
Hey,
I have been running into an issue when trying to use RenderViewAsync to write to an HTTP Response Body output stream.
It seems like RenderViewAsync writes to the stream passed in Syncronously in some situations which causes issues with Kestral unless you set this flag
I have created some unit tests reproducing the bugs in this branch
I was also able to produce this bug in the MVC sample in this branch
Some things i have noticed with this bug: