Hi, I observed that NetworkComms sometimes reports that a connection is closed, but it isn’t as for example TCPView shows. Afterwards the application is no more able to reconnect.
The problem seems to be when there is an exception during deserialization.
You can reproduce this behaviour like this in ProtobufSerializer.cs:
static int counter = 0;
/// <inheritdoc />
protected override object DeserialiseDataObjectInt(Stream inputStream, Type resultType, Dictionary<string, string> options)
{
counter++;
if (counter == 500) // Handle the first messages 99 proper, the provoke an exception
{
System.Diagnostics.Debug.WriteLine("Provoke exception");
throw new InvalidOperationException("Test network connection");
}
return ProtoBuf.Serializer.NonGeneric.Deserialize(resultType, inputStream);
}
When the exception is thrown, NetworkComms reports that the connection is closed, but this is not the case.
The original reason why I got an exception here, was due to an initialization problem of protobuf, but the exception was hidden by NetworkComms and therefore hard to find.