Bug in WriteJson
Closed this issue · 2 comments
I tried to use the Connect operation to disable verbose mode, but the client blow up. It is something to do with WriteJson using the IBufferWriter directly and then calling it’s own Advance method.
I have some tests that shows this. Will add more details later this weekend when I’m at my pc.
to be brutally honest, I hadn't "tested" this at all 😬
You are right the direct writing was tripping up the Writer.
It seems to work ok now. But it seems a bit hacky. (0e86158)
I need to properly study how the Writer should work. It's main job is to "allocate" spans from the output and keep track of "buffered". I've used EnsureMore()
which does track buffered properly after writing direct to the output
. But it feels a little dirty.
The version now in there uses a separate buffer to write the json, then copies to the output.
Not "ideal" but seems to be the-way-it's-done