Closed idg10 closed 2 years ago
I also came accross this isse with the ReceiverHost and also spotted that the Retry mechanism that these exceptions are falling back on does not seem to be functioning correctly. It recreates the NmeaToAisMessageTypeProcessor and the NmeaLineToAisStreamAdapter but without recreating the TcpClient in NetworkStreamNmeaReceiver I was unable to re-attatch to the stream as the TcpClient had already been disposed of.
I completely agree with your change as it will eliminate the need for the Retryable to fire in these situations but it may also be worth having a look at that mechanism as it may not be functioning as intended.
Added in #142
Bad AIS messages are a fact of life. The
NmeaLineParser
constructor detects various clear indications of bad data and throws anArgumentException
. TheReceiverHost
does not handle these exceptions, causing it to crash if a bad message is received.We should handle
ArgumentException
from this line:https://github.com/ais-dotnet/Ais.Net.Receiver/blob/88f5211c37c6a3156d4d79ff2f47bdb77b1455b6/Solutions/Ais.Net.Receiver/Ais/Net/Receiver/Receiver/ReceiverHost.cs#L59
We should consider adding a new
IObservable<T>
property reporting these bad lines, so that applications can still do something with them. (E.g., if we're recording all incoming messages, it may be useful to include incomplete/corrupt ones, because manual inspection might be able to infer something from the data.)