You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I HATE to file bugs like this. It might not even be StreamJsonRpc-specific (Nerdbank?). But, in the event that it's useful at some point, here's an information dump.
We're using StreamJsonRpc over websockets. Usually everything's good. Sometimes, we go into a connect/disconnect loop where our connections immediately die. I captured some stack traces.
Error writing JSON RPC Result: IndexOutOfRangeException: Index was outside the bounds of the array.//StreamError/System.IndexOutOfRangeException: Index was outside the bounds of the array.
at Nerdbank.Streams.BufferTextWriter.Write(Char value)
at Newtonsoft.Json.JsonTextWriter.WriteEnd(JsonToken token)
at Newtonsoft.Json.JsonWriter.AutoCompleteClose(JsonContainerType type)
at Newtonsoft.Json.JsonWriter.InternalWriteEnd(JsonContainerType container)
at Newtonsoft.Json.JsonWriter.WriteEndArray()
at Newtonsoft.Json.JsonWriter.WriteEnd(JsonContainerType type)
at Newtonsoft.Json.JsonWriter.WriteEnd()
at Newtonsoft.Json.JsonWriter.AutoCompleteAll()
at Newtonsoft.Json.JsonWriter.Close()
at Newtonsoft.Json.JsonTextWriter.Close()
at Newtonsoft.Json.JsonWriter.Dispose(Boolean disposing)
at Newtonsoft.Json.JsonWriter.System.IDisposable.Dispose()
at StreamJsonRpc.JsonMessageFormatter.WriteJToken(IBufferWriter`1 contentBuffer, JToken json)
at StreamJsonRpc.JsonMessageFormatter.Serialize(IBufferWriter`1 contentBuffer, JsonRpcMessage message)
at StreamJsonRpc.WebSocketMessageHandler.WriteCoreAsync(JsonRpcMessage content, CancellationToken cancellationToken)
at StreamJsonRpc.MessageHandlerBase.WriteAsync(JsonRpcMessage content, CancellationToken cancellationToken)
at StreamJsonRpc.JsonRpc.HandleRpcAsync(JsonRpcMessage rpc)
Error writing JSON RPC Result: ArgumentOutOfRangeException: Specified argument was out of the range of valid values.//StreamError/System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values.
at Nerdbank.Streams.BufferTextWriter.Write(ReadOnlySpan`1 buffer)
at Nerdbank.Streams.BufferTextWriter.Write(String value)
at Newtonsoft.Json.JsonTextWriter.WriteValueInternal(String value, JsonToken token)
at Newtonsoft.Json.JsonTextWriter.WriteNull()
at Newtonsoft.Json.JsonWriter.AutoCompleteClose(JsonContainerType type)
at Newtonsoft.Json.JsonWriter.InternalWriteEnd(JsonContainerType container)
at Newtonsoft.Json.JsonWriter.WriteEndObject()
at Newtonsoft.Json.JsonWriter.WriteEnd(JsonContainerType type)
at Newtonsoft.Json.JsonWriter.WriteEnd()
at Newtonsoft.Json.JsonWriter.AutoCompleteAll()
at Newtonsoft.Json.JsonWriter.Close()
at Newtonsoft.Json.JsonTextWriter.Close()
at Newtonsoft.Json.JsonWriter.Dispose(Boolean disposing)
at Newtonsoft.Json.JsonWriter.System.IDisposable.Dispose()
at StreamJsonRpc.JsonMessageFormatter.WriteJToken(IBufferWriter`1 contentBuffer, JToken json)
at StreamJsonRpc.JsonMessageFormatter.Serialize(IBufferWriter`1 contentBuffer, JsonRpcMessage message)
at StreamJsonRpc.WebSocketMessageHandler.WriteCoreAsync(JsonRpcMessage content, CancellationToken cancellationToken)
at StreamJsonRpc.MessageHandlerBase.WriteAsync(JsonRpcMessage content, CancellationToken cancellationToken)
at StreamJsonRpc.JsonRpc.HandleRpcAsync(JsonRpcMessage rpc)
and finally, it seems to be in the connect/disconnect loop when throwing:
Error writing JSON RPC Result: InvalidOperationException: This instance must be flushed before being reinitialized.//StreamError/System.InvalidOperationException: This instance must be flushed before being reinitialized.
at Microsoft.Verify.Operation(Boolean condition, String message)
at Nerdbank.Streams.BufferTextWriter.Initialize(IBufferWriter`1 bufferWriter, Encoding encoding)
at StreamJsonRpc.JsonMessageFormatter.WriteJToken(IBufferWriter`1 contentBuffer, JToken json)
at StreamJsonRpc.JsonMessageFormatter.Serialize(IBufferWriter`1 contentBuffer, JsonRpcMessage message)
at StreamJsonRpc.WebSocketMessageHandler.WriteCoreAsync(JsonRpcMessage content, CancellationToken cancellationToken)
at StreamJsonRpc.MessageHandlerBase.WriteAsync(JsonRpcMessage content, CancellationToken cancellationToken)
at StreamJsonRpc.JsonRpc.HandleRpcAsync(JsonRpcMessage rpc)
The text was updated successfully, but these errors were encountered:
Thanks for the report. I've seen this once before. It's (gulp) good to know that it's a real bug. If you happen to have a repro, I'd love to see it. Otherwise I'll just do my best at code inspection and test writing to try to stumble upon the bug.
I suspect this is due to one or more bugs in Nerdbank.Streams. I'm closing this issue in favor of the one linked above (which references back to this one for details). You may want to follow that issue for status updates.
#303 ended up being due to a customer reusing a formatter for several handlers. This is not allowed, but we may not have had documentation calling that out.
I HATE to file bugs like this. It might not even be StreamJsonRpc-specific (Nerdbank?). But, in the event that it's useful at some point, here's an information dump.
We're using StreamJsonRpc over websockets. Usually everything's good. Sometimes, we go into a connect/disconnect loop where our connections immediately die. I captured some stack traces.
and finally, it seems to be in the connect/disconnect loop when throwing:
The text was updated successfully, but these errors were encountered: