When the MessageType fails to resolve, the OutboxSendingTask will fall into an infinite loop attempting to LockAndSelect the same messages, perpetually failing to publish/abort any of them.
This can occur when a message is added to the outbox but not published prior to the type registration being removed from the host application.
public async Task<IReadOnlyCollection<OutboxMessage>> LockAndSelect(string instanceId, int batchSize, bool tableLock, TimeSpan lockDuration, CancellationToken token)
{
...
while (await reader.ReadAsync(token).ConfigureAwait(false))
{
...
BusName = reader.GetString(busNameOrdinal),
MessageType = Settings.MessageTypeResolver.ToType(messageType) ?? throw new MessageBusException($"Outbox message with Id {id} - the MessageType {messageType} is not recognized. The type might have been renamed or moved namespaces."),
MessagePayload = reader.GetSqlBinary(payloadOrdinal).Value,
...
}
...
}
When the
MessageType
fails to resolve, theOutboxSendingTask
will fall into an infinite loop attempting toLockAndSelect
the same messages, perpetually failing to publish/abort any of them.This can occur when a message is added to the outbox but not published prior to the type registration being removed from the host application.